@samuelgomez/astro 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +54 -0
  2. package/package.json +42 -0
  3. package/src/components/Accordion/index.astro +31 -0
  4. package/src/components/Alert/AlertDanger.astro +12 -0
  5. package/src/components/Alert/AlertInfo.astro +12 -0
  6. package/src/components/Alert/AlertSuccess.astro +12 -0
  7. package/src/components/Alert/AlertWarning.astro +12 -0
  8. package/src/components/Alert/index.astro +10 -0
  9. package/src/components/Badge/BadgeDanger.astro +15 -0
  10. package/src/components/Badge/BadgeInfo.astro +15 -0
  11. package/src/components/Badge/BadgeSuccess.astro +15 -0
  12. package/src/components/Badge/BadgeWarning.astro +15 -0
  13. package/src/components/Badge/index.astro +9 -0
  14. package/src/components/Box/index.astro +45 -0
  15. package/src/components/BoxPost/index.astro +66 -0
  16. package/src/components/Button/index.astro +35 -0
  17. package/src/components/Caniuse/index.astro +24 -0
  18. package/src/components/Codepen/index.astro +25 -0
  19. package/src/components/DebugGrid/index.astro +100 -0
  20. package/src/components/Demo/Demoui.astro +13 -0
  21. package/src/components/Demo/index.astro +105 -0
  22. package/src/components/Dialog/index.astro +74 -0
  23. package/src/components/FormattedDate/index.astro +17 -0
  24. package/src/components/GithubContributions/index.astro +88 -0
  25. package/src/components/Home/CardsBlog.astro +41 -0
  26. package/src/components/Home/CardsCodepen.astro +53 -0
  27. package/src/components/Home/CardsGithub.astro +44 -0
  28. package/src/components/Img/index.astro +28 -0
  29. package/src/components/Link/index.astro +33 -0
  30. package/src/components/Nav/NavToggle.astro +40 -0
  31. package/src/components/Nav/index.astro +71 -0
  32. package/src/components/Pagination/PaginationItem.astro +51 -0
  33. package/src/components/Pagination/index.astro +39 -0
  34. package/src/components/ScrollWatcher/index.astro +11 -0
  35. package/src/components/Social/index.astro +22 -0
  36. package/src/components/Support/index.astro +24 -0
  37. package/src/components/Svg/index.astro +30 -0
  38. package/src/components/SwitchTheme.astro +45 -0
  39. package/src/components/Table/Table.astro +15 -0
  40. package/src/components/Table/TableBody.astro +21 -0
  41. package/src/components/Table/TableHeader.astro +19 -0
  42. package/src/components/Table/index.astro +21 -0
  43. package/src/components/TableOfContent/index.astro +117 -0
  44. package/src/components/Tabs/TabList.astro +23 -0
  45. package/src/components/Tabs/TabListItem.astro +22 -0
  46. package/src/components/Tabs/TabPanel.astro +19 -0
  47. package/src/components/Tabs/TabsContainer.astro +174 -0
  48. package/src/components/Tabs/index.astro +46 -0
  49. package/src/components/Title/h1.astro +12 -0
  50. package/src/components/Title/h2.astro +12 -0
  51. package/src/components/Title/h3.astro +12 -0
  52. package/src/components/Title/h4.astro +12 -0
  53. package/src/components/Title/h5.astro +12 -0
  54. package/src/components/Title/h6.astro +12 -0
  55. package/src/components/Title/heading.astro +8 -0
  56. package/src/components/Title/index.astro +39 -0
  57. package/src/components/WrapperToHtml/index.astro +8 -0
  58. package/src/components/form/Field/index.astro +43 -0
  59. package/src/components/form/Fieldset/index.astro +14 -0
  60. package/src/components/form/Form/FieldDate.astro +32 -0
  61. package/src/components/form/Form/FieldEmail.astro +32 -0
  62. package/src/components/form/Form/FieldNumber.astro +35 -0
  63. package/src/components/form/Form/FieldPassword.astro +32 -0
  64. package/src/components/form/Form/FieldRadio.astro +32 -0
  65. package/src/components/form/Form/FieldSelect.astro +26 -0
  66. package/src/components/form/Form/FieldText.astro +35 -0
  67. package/src/components/form/Form/FieldTextarea.astro +25 -0
  68. package/src/components/form/Form/index.astro +5 -0
  69. package/src/components/form/Input/index.astro +27 -0
  70. package/src/components/form/InputRadio/index.astro +30 -0
  71. package/src/components/form/MoreInfo/index.astro +14 -0
  72. package/src/components/form/Select/index.astro +25 -0
  73. package/src/components/form/Status/index.astro +34 -0
  74. package/src/components/form/Textarea/index.astro +26 -0
  75. package/src/components/helpers/WrapperOrNot/index.astro +23 -0
  76. package/src/components/layout/Footer.astro +3 -0
  77. package/src/components/layout/Head.astro +154 -0
  78. package/src/components/layout/Header.astro +28 -0
  79. package/src/components/old/Grid.astro +18 -0
  80. package/src/components/old/Section.astro +19 -0
  81. package/src/components/old/SwitchTheme.astro +66 -0
  82. package/src/components/old/index-webco.astro +55 -0
  83. package/src/components/old/send.astro +28 -0
  84. package/src/helpers/dom.ts +19 -0
  85. package/src/helpers/isEmptyOrNull.test.ts +58 -0
  86. package/src/helpers/isEmptyOrNull.ts +6 -0
  87. package/src/helpers/setSlug.test.ts +20 -0
  88. package/src/helpers/setSlug.ts +7 -0
  89. package/src/helpers/setTocTitle.ts +2 -0
  90. package/src/helpers/setVariants.test.ts +26 -0
  91. package/src/helpers/setVariants.ts +18 -0
  92. package/src/icons/Add.astro +18 -0
  93. package/src/icons/Anchor.astro +22 -0
  94. package/src/icons/Arrow.astro +11 -0
  95. package/src/icons/AstroLogo.astro +35 -0
  96. package/src/icons/Check.astro +11 -0
  97. package/src/icons/ChevronDown.astro +11 -0
  98. package/src/icons/ChevronLeft.astro +11 -0
  99. package/src/icons/ChevronRight.astro +11 -0
  100. package/src/icons/Codepen.astro +36 -0
  101. package/src/icons/Cross.astro +11 -0
  102. package/src/icons/ExternalLink.astro +19 -0
  103. package/src/icons/Github.astro +36 -0
  104. package/src/icons/Github2.astro +11 -0
  105. package/src/icons/Grid.astro +19 -0
  106. package/src/icons/Info.astro +11 -0
  107. package/src/icons/Instagram.astro +11 -0
  108. package/src/icons/Linkedin.astro +11 -0
  109. package/src/icons/LogoSG.astro +66 -0
  110. package/src/icons/MoonSun.astro +17 -0
  111. package/src/icons/Send.astro +11 -0
  112. package/src/icons/Slash.astro +14 -0
  113. package/src/icons/Trash.astro +19 -0
  114. package/src/icons/Twitter.astro +14 -0
  115. package/src/types/Permutations.d.ts +3 -0
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Astro Starter Kit: Basics
2
+
3
+ ```sh
4
+ npm create astro@latest -- --template basics
5
+ ```
6
+
7
+ [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
8
+ [![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics)
9
+ [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json)
10
+
11
+ > 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
12
+
13
+ ![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554)
14
+
15
+ ## 🚀 Project Structure
16
+
17
+ Inside of your Astro project, you'll see the following folders and files:
18
+
19
+ ```text
20
+ /
21
+ ├── public/
22
+ │ └── favicon.svg
23
+ ├── src/
24
+ │ ├── components/
25
+ │ │ └── Card.astro
26
+ │ ├── layouts/
27
+ │ │ └── Layout.astro
28
+ │ └── pages/
29
+ │ └── index.astro
30
+ └── package.json
31
+ ```
32
+
33
+ Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
34
+
35
+ There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
36
+
37
+ Any static assets, like images, can be placed in the `public/` directory.
38
+
39
+ ## 🧞 Commands
40
+
41
+ All commands are run from the root of the project, from a terminal:
42
+
43
+ | Command | Action |
44
+ | :------------------------ | :----------------------------------------------- |
45
+ | `npm install` | Installs dependencies |
46
+ | `npm run dev` | Starts local dev server at `localhost:4321` |
47
+ | `npm run build` | Build your production site to `./dist/` |
48
+ | `npm run preview` | Preview your build locally, before deploying |
49
+ | `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
50
+ | `npm run astro -- --help` | Get help using the Astro CLI |
51
+
52
+ ## 👀 Want to learn more?
53
+
54
+ Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@samuelgomez/astro",
3
+ "author": "Samuel Gomez",
4
+ "type": "module",
5
+ "version": "0.1.0",
6
+ "exports": {
7
+ "./*": "./src/*"
8
+ },
9
+ "files": [
10
+ "src"
11
+ ],
12
+ "scripts": {
13
+ "dev": "astro --config ./config/astro.config.mjs dev",
14
+ "live": "astro --config ./config/astro.config.mjs dev --host",
15
+ "build": "astro --config ./config/astro.config.mjs build",
16
+ "check": "astro --config ./config/astro.config.mjs check",
17
+ "preview": "astro --config ./config/astro.config.mjs preview",
18
+ "astro": "astro",
19
+ "prettier": "prettier ./src --plugin=prettier-plugin-astro --config ./config/.prettierrc.mjs",
20
+ "prettier:fix": "npm run prettier -- --write",
21
+ "stylelint": "stylelint --ignore-path .gitignore \"**/*.css\" --config ./config/.stylelintrc.json",
22
+ "stylelint:fix": "npm run stylelint -- --fix",
23
+ "test": "vitest"
24
+ },
25
+ "dependencies": {
26
+ "@astrojs/check": "^0.9.4",
27
+ "@astrojs/mdx": "^4.3.1",
28
+ "astro": "^5.12.1"
29
+ },
30
+ "devDependencies": {
31
+ "html-format": "^1.1.7",
32
+ "prettier": "^3.6.2",
33
+ "prettier-plugin-astro": "^0.14.1",
34
+ "stylelint": "^16.22.0",
35
+ "stylelint-config-standard": "^37.0.0",
36
+ "typescript": "^5.8.3",
37
+ "vitest": "^3.2.4"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ }
42
+ }
@@ -0,0 +1,31 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+
4
+ export type AccordionProps = HTMLAttributes<'details'>;
5
+
6
+ const props = Astro.props as AccordionProps;
7
+ ---
8
+
9
+ <details {...props}>
10
+ <summary
11
+ ><slot name="summary" /><slot name="icon"
12
+ ><svg
13
+ class="chevron"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ width="24"
16
+ height="24"
17
+ viewBox="0 0 24 24"
18
+ fill="none"
19
+ stroke="currentColor"
20
+ stroke-width="2"
21
+ stroke-linecap="round"
22
+ stroke-linejoin="round"
23
+ class="feather feather-chevron-down"
24
+ ><polyline points="6 9 12 15 18 9"></polyline></svg
25
+ ></slot
26
+ >
27
+ </summary>
28
+ <div>
29
+ <slot />
30
+ </div>
31
+ </details>
@@ -0,0 +1,12 @@
1
+ ---
2
+ import { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+ import Cross from '@samuelgomez/astro/icons/Cross.astro';
4
+ import Alert from './index.astro';
5
+
6
+ const { title = 'Erreur', ...props } = Astro.props as BoxProps;
7
+ ---
8
+
9
+ <Alert aria-roledescription="error" title={title} {...props}>
10
+ <Cross slot="before-icon" />
11
+ <slot />
12
+ </Alert>
@@ -0,0 +1,12 @@
1
+ ---
2
+ import { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+ import Alert from './index.astro';
4
+ import Info from '@samuelgomez/astro/icons/Info.astro';
5
+
6
+ const { title = 'Remarque', ...props } = Astro.props as BoxProps;
7
+ ---
8
+
9
+ <Alert aria-roledescription="info" title={title} {...props}>
10
+ <Info slot="before-icon" />
11
+ <slot />
12
+ </Alert>
@@ -0,0 +1,12 @@
1
+ ---
2
+ import { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+ import Alert from './index.astro';
4
+ import Check from '@samuelgomez/astro/icons/Check.astro';
5
+
6
+ const { title = 'Succès', ...props } = Astro.props as BoxProps;
7
+ ---
8
+
9
+ <Alert aria-roledescription="success" title={title} {...props}>
10
+ <Check slot="before-icon" />
11
+ <slot />
12
+ </Alert>
@@ -0,0 +1,12 @@
1
+ ---
2
+ import { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+ import Alert from './index.astro';
4
+ import Info from '@samuelgomez/astro/icons/Info.astro';
5
+
6
+ const { title = 'Attention', ...props } = Astro.props as BoxProps;
7
+ ---
8
+
9
+ <Alert aria-roledescription="warning" title={title} {...props}>
10
+ <Info slot="before-icon" />
11
+ <slot />
12
+ </Alert>
@@ -0,0 +1,10 @@
1
+ ---
2
+ import Box, { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+
4
+ const props = Astro.props as BoxProps;
5
+ ---
6
+
7
+ <Box role="alert" {...props}>
8
+ <slot name="before-icon" slot="before-icon" />
9
+ <slot />
10
+ </Box>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+ import Badge from './index.astro';
4
+ import Cross from '@samuelgomez/astro/icons/Cross.astro';
5
+
6
+ type BadgeProps = BoxProps & {
7
+ hasIcon?: boolean;
8
+ };
9
+
10
+ const { hasIcon = true, ...props } = Astro.props as BadgeProps;
11
+ ---
12
+
13
+ <Badge aria-roledescription="error" {...props}>
14
+ {hasIcon && <Cross slot="before-icon" />}
15
+ </Badge>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+ import Badge from './index.astro';
4
+ import Info from '@samuelgomez/astro/icons/Info.astro';
5
+
6
+ type BadgeProps = BoxProps & {
7
+ hasIcon?: boolean;
8
+ };
9
+
10
+ const { hasIcon = true, ...props } = Astro.props as BadgeProps;
11
+ ---
12
+
13
+ <Badge aria-roledescription="info" {...props}>
14
+ {hasIcon && <Info slot="before-icon" />}
15
+ </Badge>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+ import Badge from './index.astro';
4
+ import Check from '@samuelgomez/astro/icons/Check.astro';
5
+
6
+ type BadgeProps = BoxProps & {
7
+ hasIcon?: boolean;
8
+ };
9
+
10
+ const { hasIcon = true, ...props } = Astro.props as BadgeProps;
11
+ ---
12
+
13
+ <Badge aria-roledescription="success" {...props}>
14
+ {hasIcon && <Check slot="before-icon" />}
15
+ </Badge>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+ import Badge from './index.astro';
4
+ import Info from '@samuelgomez/astro/icons/Info.astro';
5
+
6
+ type BadgeProps = BoxProps & {
7
+ hasIcon?: boolean;
8
+ };
9
+
10
+ const { hasIcon = true, ...props } = Astro.props as BadgeProps;
11
+ ---
12
+
13
+ <Badge aria-roledescription="warning" {...props}>
14
+ {hasIcon && <Info slot="before-icon" />}
15
+ </Badge>
@@ -0,0 +1,9 @@
1
+ ---
2
+ import Box, { type BoxProps } from '@samuelgomez/astro/components/Box/index.astro';
3
+
4
+ const props = Astro.props as BoxProps;
5
+ ---
6
+
7
+ <Box role="status" {...props}>
8
+ <slot name="before-icon" slot="before-icon" />
9
+ </Box>
@@ -0,0 +1,45 @@
1
+ ---
2
+ import type { HTMLTag, HTMLAttributes } from 'astro/types';
3
+ import Title from '@samuelgomez/astro/components/Title/index.astro';
4
+ import FormattedDate from '@samuelgomez/astro/components/FormattedDate/index.astro';
5
+ import WrapperOrNot from '@samuelgomez/astro/components/helpers/WrapperOrNot/index.astro';
6
+ import { setSlug } from '@samuelgomez/astro/helpers/setSlug';
7
+
8
+ type Ttag = 'article' | 'aside' | 'div' | 'section' | 'header' | 'footer';
9
+
10
+ export type BoxProps = HTMLAttributes<Ttag> & {
11
+ title?: string;
12
+ description?: string;
13
+ tag?: Ttag;
14
+ class?: string;
15
+ titleLevel?: 1 | 2 | 3 | 4 | 5 | 6;
16
+ pubDate?: string;
17
+ };
18
+
19
+ const {
20
+ title,
21
+ description,
22
+ class: className,
23
+ tag = 'article',
24
+ titleLevel = 4,
25
+ pubDate,
26
+ ...props
27
+ } = Astro.props as BoxProps;
28
+
29
+ const content = await Astro.slots.render('default');
30
+
31
+ const ariaLabelledBy = title ? setSlug(title) : null;
32
+
33
+ const BoxTag = tag ?? ('article' as HTMLTag);
34
+ ---
35
+
36
+ <BoxTag aria-labelledby={ariaLabelledBy} {...props}>
37
+ <slot name="before-icon" />
38
+
39
+ <WrapperOrNot condition={Astro.slots.has('before-icon') && Boolean(content)}>
40
+ <slot name="image" />
41
+ {title && <Title level={titleLevel} label={title} noLink />}
42
+ {pubDate && <FormattedDate date={new Date(pubDate)} />}
43
+ {Boolean(content) && <Fragment set:html={content} />}
44
+ </WrapperOrNot>
45
+ </BoxTag>
@@ -0,0 +1,66 @@
1
+ ---
2
+ import type { ImageMetadata } from 'astro';
3
+ import { Image } from 'astro:assets';
4
+ import Link from '@samuelgomez/astro/components/Link/index.astro';
5
+ import Box from '@samuelgomez/astro/components/Box/index.astro';
6
+ import ChevronRight from '@samuelgomez/astro/icons/ChevronRight.astro';
7
+ import { isEmptyObject } from '@samuelgomez/astro/helpers/isEmptyOrNull';
8
+
9
+ const {
10
+ title,
11
+ slug,
12
+ pubDate,
13
+ heroImage,
14
+ alt = '',
15
+ type = '',
16
+ category = '',
17
+ } = Astro.props;
18
+
19
+ let image = {} as ImageMetadata;
20
+
21
+ if (Boolean(heroImage)) {
22
+ const baseImagePath = '/src/assets/images/';
23
+ const imagePath = `${baseImagePath}${heroImage}`;
24
+ const imageGlob = `${baseImagePath}*.{jpeg,jpg,png,gif,webp}`;
25
+
26
+ const images = import.meta.glob<{ default: ImageMetadata }>(
27
+ '/src/assets/images/*.{jpeg,jpg,png,gif,webp}'
28
+ );
29
+
30
+ if (!images[imagePath]) {
31
+ throw new Error(`"${imagePath}" does not exist in glob: "${imageGlob}"`);
32
+ }
33
+
34
+ const { default: imageSrc } = await images[imagePath]();
35
+ image = imageSrc;
36
+ }
37
+
38
+ const href = `${category ? `/${category}/${slug}` : `/${slug}`}`;
39
+
40
+ ---
41
+
42
+ <Box title={title} titleLevel={3} pubDate={pubDate}>
43
+ {
44
+ !isEmptyObject(image) && (
45
+ <figure data-type={Boolean(type) ? type : null} slot="image">
46
+ <Image
47
+ src={image}
48
+ alt=""
49
+ width={image.width / 2}
50
+ quality="max"
51
+ aria-hidden="true"
52
+ />
53
+ {Boolean(alt) && <figcaption>{alt}</figcaption>}
54
+ </figure>
55
+ )
56
+ }
57
+ <slot />
58
+ {
59
+ Boolean(slug) && (
60
+ <Link href={href}>
61
+ Voir {title}
62
+ <ChevronRight slot="after-link" />
63
+ </Link>
64
+ )
65
+ }
66
+ </Box>
@@ -0,0 +1,35 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import type { Permutations } from 'types/Permutations';
4
+ import { setClassVariant } from '@samuelgomez/astro/helpers/setVariants';
5
+
6
+ type Tvariant = Permutations<
7
+ 'ghost' | 'danger' | 'success' | 'warning' | 'reverse' | 'small'
8
+ >;
9
+
10
+ export type ButtonProps = HTMLAttributes<'button'> & {
11
+ variant?: Tvariant;
12
+ };
13
+
14
+ const {
15
+ type = 'button',
16
+ variant,
17
+ class: className,
18
+ disabled,
19
+ ...props
20
+ } = Astro.props as ButtonProps;
21
+
22
+ const newClass = setClassVariant({ className, variant });
23
+ ---
24
+
25
+ <button
26
+ class={newClass ?? null}
27
+ type={type}
28
+ disabled={disabled}
29
+ aria-disabled={disabled ? 'true' : null}
30
+ {...props}
31
+ >
32
+ <slot name="before-button" />
33
+ <slot />
34
+ <slot name="after-button" />
35
+ </button>
@@ -0,0 +1,24 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import Dialog from '@samuelgomez/astro/components/Dialog/index.astro';
4
+ import Button from '@samuelgomez/astro/components/Button/index.astro';
5
+
6
+ export type Props = HTMLAttributes<'dialog'> & {
7
+ property?: string;
8
+ };
9
+
10
+ const { id, property, ...props } = Astro.props;
11
+ ---
12
+
13
+ <Dialog id={`caniuse-${id}`} openerVariant="small" {...props}>
14
+ <Fragment slot="opener">Voir les compatibilités</Fragment>
15
+ <Fragment slot="title">Compatibilités navigateur</Fragment>
16
+ <iframe
17
+ slot="content"
18
+ src={`https://caniuse.com/${property}`}
19
+ allowfullscreen="true"
20
+ loading="lazy"></iframe>
21
+ <Fragment slot="footer-content"
22
+ ><Button variant="small" data-action="close">Fermer</Button>
23
+ </Fragment>
24
+ </Dialog>
@@ -0,0 +1,25 @@
1
+ ---
2
+ type Props = {
3
+ id: string;
4
+ title: string;
5
+ style?: string;
6
+ tabs?: string;
7
+ minHeight?: string;
8
+ };
9
+
10
+ const {
11
+ id,
12
+ title,
13
+ style = 'width: 100%;color: white; font-weight: bold; aspect-ratio:2;',
14
+ tabs = 'result',
15
+ minHeight = '45svh',
16
+ } = Astro.props;
17
+ ---
18
+
19
+ <iframe
20
+ style={`${style}min-height: ${minHeight};`}
21
+ title={title}
22
+ src={`https://codepen.io/gsam59/embed/${id}?default-tab=${tabs}`}
23
+ loading="lazy"
24
+ allowtransparency="true"
25
+ allowfullscreen="true"></iframe>
@@ -0,0 +1,100 @@
1
+ ---
2
+ import Grid from '@samuelgomez/astro/icons/Grid.astro';
3
+ ---
4
+
5
+ <div class="debug-grid">
6
+ <main>
7
+ {[...Array(12).keys()].map(() => <div class="cols" />)}
8
+ </main>
9
+ </div>
10
+ <label>
11
+ <span id="debuggrid-label">Afficher ou masquer les grilles</span>
12
+ <input type="checkbox" name="debuggrid" aria-labelledby="debuggrid-label" />
13
+ <Grid />
14
+ </label>
15
+
16
+ <style>
17
+ label:has([name='debuggrid']) {
18
+ position: fixed;
19
+ z-index: 2;
20
+ inset: auto auto 0.5rem 0.5rem;
21
+ z-index: 2;
22
+ background-color: var(--c);
23
+ border-radius: var(--rounded);
24
+ padding: var(--p-2);
25
+ color: var(--bgc);
26
+ &:hover,
27
+ &:has(> :checked) {
28
+ color: var(--bl6);
29
+ }
30
+
31
+ > span {
32
+ display: none;
33
+ }
34
+ input {
35
+ position: absolute;
36
+ opacity: 0;
37
+ width: 0;
38
+ height: 0;
39
+ pointer-events: none;
40
+ }
41
+ }
42
+
43
+ .debug-grid {
44
+ position: fixed;
45
+ top: 0;
46
+ left: 0;
47
+ display: none;
48
+ width: 100%;
49
+ height: 100%;
50
+
51
+ main {
52
+ --name-xs: 'under SM 640px';
53
+ --color-bg-cols-xs: var(--pp2);
54
+ --name-sm: 'sm : 640px to 767px';
55
+ --color-bg-cols-sm: var(--bl2);
56
+ --name-md: 'md : 768px to 1023px';
57
+ --color-bg-cols-md: var(--og2);
58
+ --name-lg: 'lg : 1024px to 1279px';
59
+ --color-bg-cols-lg: var(--gn1);
60
+ --name-xl: 'xl : 1280px to 1535px';
61
+ --color-bg-cols-xl: var(--rd1);
62
+ --name-2xl: '2xl : over 1535px';
63
+ --color-bg-cols-2xl: var(--tk6);
64
+
65
+ position: relative;
66
+ height: 100%;
67
+ opacity: 0.5;
68
+
69
+ &::before {
70
+ position: absolute;
71
+ top: 50%;
72
+ left: 0.5vw;
73
+ width: 100%;
74
+ height: 100%;
75
+ font-size: clamp(0.5rem, 4vw, 2.5rem);
76
+ text-align: center;
77
+ text-orientation: mixed;
78
+ writing-mode: vertical-rl;
79
+ color: color-mix(in hsl, var(--color-bg-cols), rgb(0, 0, 0) 20%);
80
+ transform: translate(0, -50%);
81
+ transition: color 300ms linear 200ms;
82
+ content: var(--name);
83
+ }
84
+
85
+ .cols {
86
+ display: block;
87
+ height: 100%;
88
+ grid-column: span 1;
89
+ background-color: var(--color-bg-cols);
90
+ transition: background-color 300ms linear 200ms;
91
+ }
92
+ }
93
+ }
94
+
95
+ body:has([name='debuggrid']:checked) {
96
+ .debug-grid {
97
+ display: block;
98
+ }
99
+ }
100
+ </style>
@@ -0,0 +1,13 @@
1
+ ---
2
+ import Demo from './index.astro';
3
+ import beautify from 'html-format';
4
+
5
+ const htmlRaw = await Astro.slots.render('default');
6
+ const html = beautify(htmlRaw);
7
+ const { jsx, wrapperTag } = Astro.props;
8
+ ---
9
+
10
+ <Demo wrapperTag={wrapperTag}>
11
+ <Fragment slot="html" set:html={html} />
12
+ <Fragment slot="code" set:html={jsx} />
13
+ </Demo>