diff options
author | 2022-09-07 18:16:54 -0400 | |
---|---|---|
committer | 2022-09-07 18:16:54 -0400 | |
commit | d6adb67ae4909d790aa44e1d52cfea3e8ad7663f (patch) | |
tree | 3b7dc0bd69da90ed290490ec5629898941e19a92 /examples/component/packages/my-component | |
parent | f165353e7abe9472a6096324154a4801fac46c66 (diff) | |
download | astro-d6adb67ae4909d790aa44e1d52cfea3e8ad7663f.tar.gz astro-d6adb67ae4909d790aa44e1d52cfea3e8ad7663f.tar.zst astro-d6adb67ae4909d790aa44e1d52cfea3e8ad7663f.zip |
chore: update component template (#4540)
Co-authored-by: Nate Moore <nate@astro.build>
Diffstat (limited to 'examples/component/packages/my-component')
5 files changed, 0 insertions, 89 deletions
diff --git a/examples/component/packages/my-component/Button.astro b/examples/component/packages/my-component/Button.astro deleted file mode 100644 index 87943fa28..000000000 --- a/examples/component/packages/my-component/Button.astro +++ /dev/null @@ -1,13 +0,0 @@ ---- -export interface Props extends Record<any, any> { - type?: string; -} - -const { type, ...props } = { - ...Astro.props, -}; - -props.type = type || 'button'; ---- - -<button {...props}><slot /></button> diff --git a/examples/component/packages/my-component/Heading.astro b/examples/component/packages/my-component/Heading.astro deleted file mode 100644 index 75e4aa4e0..000000000 --- a/examples/component/packages/my-component/Heading.astro +++ /dev/null @@ -1,15 +0,0 @@ ---- -export interface Props extends Record<any, any> { - level?: number | string; - role?: string; -} - -const { level, role, ...props } = { - ...Astro.props, -}; - -props.role = role || 'heading'; -props['aria-level'] = level || '1'; ---- - -<h {...props}><slot /></h> diff --git a/examples/component/packages/my-component/README.md b/examples/component/packages/my-component/README.md deleted file mode 100644 index 41a53a6f0..000000000 --- a/examples/component/packages/my-component/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Example `@example/my-component` - -This is an example package, exported as `@example/my-component`. It consists of two Astro components, **Button** and **Heading**. - -### Button - -The **Button** component generates a `<button>` with a default **type** of **button**. - -```astro ---- -import * as Component from '@example/my-component' ---- -<Component.Button>Plain Button</Component.Button> -``` - -```html -<!-- generated html --> -<button type="button">Plain Button</button> -``` - -### Heading - -The **Heading** component generates an `<h>` tag with a default **role** of **heading** and a **level** attribute that gets written to **aria-level**. - -```astro ---- -import * as Component from '@example/my-component' ---- -<Component.Heading>Heading</Component.Heading> -<Component.Heading level="2">Subheading</Component.Heading> -``` - -```html -<!-- generated html --> -<h role="heading" aria-level="1">Plain Button</h> -<h role="heading" aria-level="2">Subheading</h> -``` diff --git a/examples/component/packages/my-component/index.js b/examples/component/packages/my-component/index.js deleted file mode 100644 index 603a81a96..000000000 --- a/examples/component/packages/my-component/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default as Button } from './Button.astro'; -export { default as Heading } from './Heading.astro'; diff --git a/examples/component/packages/my-component/package.json b/examples/component/packages/my-component/package.json deleted file mode 100644 index 47212b558..000000000 --- a/examples/component/packages/my-component/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@example/my-component", - "version": "0.0.1", - "private": true, - "type": "module", - "exports": { - ".": "./index.js", - "./Button": "./Button.astro", - "./Heading": "./Heading.astro" - }, - "files": [ - "index.js", - "Button.astro", - "Heading.jsx" - ], - "keywords": [ - "astro-component", - "button", - "heading", - "example" - ] -} |