diff options
author | 2021-06-24 17:48:24 -0500 | |
---|---|---|
committer | 2021-06-24 17:48:24 -0500 | |
commit | a136c85e6b2b0445e48184595b2696994621c8f1 (patch) | |
tree | 4d06743cf5b0e3f8f5dabcd1c8ae9e8b9b4557b2 /examples/docs/src | |
parent | bc9e0f180ccec7d48fde49c857188543e007bf14 (diff) | |
download | astro-a136c85e6b2b0445e48184595b2696994621c8f1.tar.gz astro-a136c85e6b2b0445e48184595b2696994621c8f1.tar.zst astro-a136c85e6b2b0445e48184595b2696994621c8f1.zip |
New Props API (#515)
* wip: update props api
* feat(#139, #309): enable new props api
* chore: migrate examples to new props API
* docs: update syntax guide for new props API
* chore: update examples to new props API
* chore: update docs to new Props API
* fix: hide __astroInternal from `Astro.props` consumers
* chore: remove scratchpad file
* chore: fix script error
* test: fix failing collection tests
* fix: set __astroInternal to `enumerable: false`
* chore: add changeset
* feat: warn users using old props api
Diffstat (limited to 'examples/docs/src')
-rw-r--r-- | examples/docs/src/components/Note.astro | 7 | ||||
-rw-r--r-- | examples/docs/src/layouts/Main.astro | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/examples/docs/src/components/Note.astro b/examples/docs/src/components/Note.astro index 46940ddf8..c57ede3a0 100644 --- a/examples/docs/src/components/Note.astro +++ b/examples/docs/src/components/Note.astro @@ -1,6 +1,9 @@ --- -export let type = "tip"; -export let title; +export interface Props { + title: string; + type?: 'tip' | 'warning' | 'error' +} +const { type = 'tip', title } = Astro.props; --- <aside class={`note type-${type}`}> diff --git a/examples/docs/src/layouts/Main.astro b/examples/docs/src/layouts/Main.astro index 77407918a..0f1e6efe4 100644 --- a/examples/docs/src/layouts/Main.astro +++ b/examples/docs/src/layouts/Main.astro @@ -4,7 +4,7 @@ import SiteSidebar from '../components/SiteSidebar.astro'; import ThemeToggle from '../components/ThemeToggle.tsx'; import DocSidebar from '../components/DocSidebar.tsx'; -export let content; +const { content } = Astro.props; const headers = content?.astro?.headers; let editHref = Astro?.request?.url?.pathname?.slice(1) ?? ''; if (editHref === '') editHref = `index`; |