diff options
Diffstat (limited to 'packages/integrations/mdx/test/fixtures/astro-content-css/src')
4 files changed, 55 insertions, 0 deletions
diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/config.ts b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/config.ts new file mode 100644 index 000000000..bf1a34c05 --- /dev/null +++ b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/config.ts @@ -0,0 +1,12 @@ +// 1. Import utilities from `astro:content` +import { z, defineCollection } from 'astro:content'; +// 2. Define a schema for each collection you'd like to validate. +const dynamicCollection = defineCollection({ + schema: z.object({ + title: z.string(), + }), +}); +// 3. Export a single `collections` object to register your collection(s) +export const collections = { + dynamic: dynamicCollection, +}; diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/FirstComponentWithJS.astro b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/FirstComponentWithJS.astro new file mode 100644 index 000000000..f3b588b42 --- /dev/null +++ b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/FirstComponentWithJS.astro @@ -0,0 +1,18 @@ +---
+const { text } = Astro.props;
+---
+<!DOCTYPE html>
+<html lang="en">
+ <head><meta charset="utf-8" /></head>
+ <body>
+ <div id="first">1st components with js. Props: {text}. <span>Styles</span>. JS: </div>
+ </body>
+</html>
+<script>
+ document.querySelector('#first').innerHTML += 'works';
+</script>
+<style>
+ #first > span {
+ color: CornflowerBlue;
+ }
+</style>
\ No newline at end of file diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/first-component-with-js.mdx b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/first-component-with-js.mdx new file mode 100644 index 000000000..0abdfbe3a --- /dev/null +++ b/packages/integrations/mdx/test/fixtures/astro-content-css/src/content/dynamic/first-component-with-js.mdx @@ -0,0 +1,9 @@ +--- +title: 'First component' +--- + +import FirstDynamicComponentWithJS from './FirstComponentWithJS.astro'; + +<FirstDynamicComponentWithJS text={props.mdProps} /> + +Additional text from mdx 'first-component-with-js' diff --git a/packages/integrations/mdx/test/fixtures/astro-content-css/src/pages/index.astro b/packages/integrations/mdx/test/fixtures/astro-content-css/src/pages/index.astro new file mode 100644 index 000000000..63ea9ddbb --- /dev/null +++ b/packages/integrations/mdx/test/fixtures/astro-content-css/src/pages/index.astro @@ -0,0 +1,16 @@ +--- +import { getCollection } from 'astro:content'; + +const entries = await getCollection('dynamic'); +--- + +<!DOCTYPE html> +<html lang="en"> + <head><meta charset="utf-8" /></head> + <body> + {entries.map(async entry => { + const { Content } = await entry.render(); + return <Content mdProps="work" />; + })} + </body> +</html> |