summaryrefslogtreecommitdiff
path: root/examples/component
diff options
context:
space:
mode:
Diffstat (limited to 'examples/component')
-rw-r--r--examples/component/astro.config.mjs4
-rw-r--r--examples/component/demo/src/pages/index.astro45
-rw-r--r--examples/component/packages/my-component/Button.astro16
-rw-r--r--examples/component/packages/my-component/Heading.astro21
4 files changed, 38 insertions, 48 deletions
diff --git a/examples/component/astro.config.mjs b/examples/component/astro.config.mjs
index 94846abde..d68cea82c 100644
--- a/examples/component/astro.config.mjs
+++ b/examples/component/astro.config.mjs
@@ -8,6 +8,6 @@
// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
- // Comment out "renderers: []" to enable Astro's default component support.
- renderers: [],
+ // Comment out "renderers: []" to enable Astro's default component support.
+ renderers: [],
});
diff --git a/examples/component/demo/src/pages/index.astro b/examples/component/demo/src/pages/index.astro
index 96ca814e3..211c2f5e3 100644
--- a/examples/component/demo/src/pages/index.astro
+++ b/examples/component/demo/src/pages/index.astro
@@ -1,29 +1,24 @@
---
-import * as Component from '@example/my-component'
+import * as Component from '@example/my-component';
---
-<html lang="en">
-
-<head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width" />
- <title>Welcome to Astro</title>
- <style global>
- h {
- display: block;
- font-size: 2em;
- font-weight: bold;
- margin-block: 0.67em;
- }
- </style>
-</head>
-<body>
- <Component.Heading>
- Welcome to Astro
- </Component.Heading>
- <Component.Button>
- Plain Button
- </Component.Button>
-</body>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width" />
+ <title>Welcome to Astro</title>
+ <style global>
+ h {
+ display: block;
+ font-size: 2em;
+ font-weight: bold;
+ margin-block: 0.67em;
+ }
+ </style>
+ </head>
-</html> \ No newline at end of file
+ <body>
+ <Component.Heading>Welcome to Astro</Component.Heading>
+ <Component.Button>Plain Button</Component.Button>
+ </body>
+</html>
diff --git a/examples/component/packages/my-component/Button.astro b/examples/component/packages/my-component/Button.astro
index d853628a1..5f32ce4e8 100644
--- a/examples/component/packages/my-component/Button.astro
+++ b/examples/component/packages/my-component/Button.astro
@@ -1,15 +1,13 @@
---
export interface Props extends Record<any, any> {
- type?: string
+ type?: string;
}
-const {
- type,
- ...props
-} = {
- ...Astro.props
-} as Props
+const { type, ...props } = {
+ ...Astro.props,
+} as Props;
-props.type = type || 'button'
+props.type = type || 'button';
---
-<button {...props}><slot /></button> \ No newline at end of file
+
+<button {...props}><slot /></button>
diff --git a/examples/component/packages/my-component/Heading.astro b/examples/component/packages/my-component/Heading.astro
index f27e74b3d..813c0c11b 100644
--- a/examples/component/packages/my-component/Heading.astro
+++ b/examples/component/packages/my-component/Heading.astro
@@ -1,18 +1,15 @@
---
export interface Props extends Record<any, any> {
- level?: number | string
- role?: string
+ level?: number | string;
+ role?: string;
}
-const {
- level,
- role,
- ...props
-} = {
- ...Astro.props
-} as Props
+const { level, role, ...props } = {
+ ...Astro.props,
+} as Props;
-props.role = role || 'heading'
-props['aria-level'] = level || '1'
+props.role = role || 'heading';
+props['aria-level'] = level || '1';
---
-<h {...props}><slot /></h> \ No newline at end of file
+
+<h {...props}><slot /></h>