diff --git a/dist/.gitkeep b/dist/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/eleventy.config.js b/eleventy.config.js
index d55e31d..e006f34 100644
--- a/eleventy.config.js
+++ b/eleventy.config.js
@@ -1,9 +1,11 @@
import browserslist from 'browserslist';
import { transform, browserslistToTargets } from 'lightningcss';
import markdownIt from 'markdown-it';
+import { eleventyImagePlugin } from '@11ty/eleventy-img';
import webc from '@11ty/eleventy-plugin-webc';
import syntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight';
import renderSvg from './lib/renderSvg.js';
+import findCollectionItem from './lib/findCollectionItem.js';
async function transformCSS(content) {
if (this.type !== 'css') {
@@ -28,9 +30,23 @@ export default function(eleventyConfig) {
eleventyConfig.addWatchTarget('src/styles/*.css');
// make functions available globally in templates
eleventyConfig.addJavaScriptFunction('renderSvg', renderSvg);
+ eleventyConfig.addJavaScriptFunction('findCollectionItem', findCollectionItem);
+ // support eleventy-image https://www.11ty.dev/docs/plugins/image
+ eleventyConfig.addPlugin(eleventyImagePlugin, {
+ formats: ['webp'],
+ widths: [800, 1600],
+ urkPath: '/assets/images/',
+ defaultAttributes: {
+ sizes: '100vw',
+ loading: 'lazy',
+ },
+ });
// load all components added to the src/components directory
eleventyConfig.addPlugin(webc, {
- components: 'src/components/**/*.webc',
+ components: [
+ 'src/components/**/*.webc',
+ 'npm:@11ty/eleventy-img/*.webc',
+ ],
bundlePluginOptions: {
transforms: [transformCSS],
},
diff --git a/lib/findCollectionItem.js b/lib/findCollectionItem.js
new file mode 100644
index 0000000..0c04f6b
--- /dev/null
+++ b/lib/findCollectionItem.js
@@ -0,0 +1,9 @@
+/**
+ * Find an item within a collection by it’s url
+ * @param {Array} collection the collection to search
+ * @param {String} url the url of the item to search for
+ * @returns A collection item or undefined
+ */
+export default function findCollectionItem(collection = [], url = '') {
+ return collection.find(post => post.url === url);
+}
\ No newline at end of file
diff --git a/src/docs/index.webc b/src/docs/index.webc
deleted file mode 100644
index a0ac3b7..0000000
--- a/src/docs/index.webc
+++ /dev/null
@@ -1,11 +0,0 @@
----
-layout: docs.webc
-tags: ['docs', 'Getting started']
-title: The problem
-description: How do you create and organise components in a way that is scalable and maintainable over time?
-icon: warning
----
-
-
- Here’s some **markdown** content.
-
diff --git a/src/docs/the-problem/hero.webp b/src/docs/the-problem/hero.webp
new file mode 100644
index 0000000..a1452ec
Binary files /dev/null and b/src/docs/the-problem/hero.webp differ
diff --git a/src/docs/the-problem/index.webc b/src/docs/the-problem/index.webc
new file mode 100644
index 0000000..f33d270
--- /dev/null
+++ b/src/docs/the-problem/index.webc
@@ -0,0 +1,110 @@
+---
+layout: docs.webc
+tags: ['docs', 'Getting started']
+title: The problem
+description: How do you create and organise components in a way that is scalable and maintainable over time?
+icon: warning
+permalink: /docs/index.html
+next: /docs/the-solution/
+---
+
+
+
+Imagine you’ve been tasked with designing a page hero. Having no other context or information to go on, you came up with the most conventional design ever.
+
+
+
+Excellent work! Now using a component-first mindset, you create a button component and a hero component.
+
+The hero takes some props:
+
+- title
+- intro
+- button text
+- button url
+
+This is awesome! It’s turned a bunch of HTML into a simple one-liner.
+
+```html
+
+```
+
+A little while later a new request comes in for a slightly different hero – a yellow variant with a new button style.
+
+
+
+Easy, you add a prop to the hero to control the background colour and another one to pass the new button variant to the CTA.
+
+It’s a couple more props, but it’s not too bad.
+
+```html
+
+```
+
+This component is pretty neat, now it’s getting more powerful and can support more variations!
+
+Over the months, more requirements come in and more props get added. Different teams have different requirements and they all need to use the component.
+
+- Eyebrow text is added above the page title.
+- A second smaller paragraph gets added below the intro (this one has links in it too).
+- The Marketing team wanted a way to feature multiple CTAs of different types (sometimes they are buttons, sometimes links).
+- The SEO team decide the eyebrow needs to be the `h1` and the “page title” text actually needs to be a `p` for maximum search power.
+
+
+
+```html
+
+
+ Suspendisse sed dictum dolor, at hendrerit nibh. Curabitur euismod
+ ipsum ut mi elementum interdum.
+
+
+```
+
+This component is getting out of hand.
+
+It’s riddled with conditional statements and testing the different combinations of props gets increasingly awkward. We would have done better just writing this out with HTML!
+
+There must be a better way!
+
+
\ No newline at end of file
diff --git a/src/docs/the-problem/max-hero.webp b/src/docs/the-problem/max-hero.webp
new file mode 100644
index 0000000..5d4d925
Binary files /dev/null and b/src/docs/the-problem/max-hero.webp differ
diff --git a/src/docs/the-problem/yellow-hero.webp b/src/docs/the-problem/yellow-hero.webp
new file mode 100644
index 0000000..37dad57
Binary files /dev/null and b/src/docs/the-problem/yellow-hero.webp differ
diff --git a/src/docs/the-solution.webc b/src/docs/the-solution.webc
deleted file mode 100644
index bbc841c..0000000
--- a/src/docs/the-solution.webc
+++ /dev/null
@@ -1,7 +0,0 @@
----
-layout: docs.webc
-tags: ['docs', 'Getting started']
-title: The solution
-description: Diamond UI is a method of organising and grouping components to cleanly separate their responsibilities.
-icon: tick
----
diff --git a/src/docs/the-solution/index.webc b/src/docs/the-solution/index.webc
new file mode 100644
index 0000000..7cccd3b
--- /dev/null
+++ b/src/docs/the-solution/index.webc
@@ -0,0 +1,67 @@
+---
+layout: docs.webc
+tags: ['docs', 'Getting started']
+title: The solution
+description: Diamond UI is a method of organising and grouping components to cleanly separate their responsibilities.
+icon: tick
+previous: /docs/
+next: /docs/content/
+---
+
+
+
+When you think about it, a component is a function that takes some parameters and returns some HTML.
+
+When writing code a generally agreed-on principle is that a function should *do one thing*. This makes functions more readable, modular and easy to maintain.
+
+Here’s our page hero component as a function:
+
+```js
+function pageHero(
+ title,
+ intro,
+ cta,
+ url,
+ ctaTarget,
+ ctaRel,
+ ctaStyle,
+ theme,
+ eyebrow,
+ eyebrowTag,
+ titleTag,
+ secondaryCta,
+ secondaryCtaType,
+ secondaryCtaStyle,
+ onSecondaryCtaClick,
+ secondaryText
+) {
+ let result = ``;
+
+ if (eyebrow) {
+ result += `<${eyebrowTag} class="page-hero__eyebrow">${eyebrow}${eyebrowTag}>`;
+ }
+
+ result += `<${titleTag} class="page-hero__title">${title}${titleTag}>`;
+
+ // ...horror continues...
+
+ return result;
+}
+```
+
+If there was a function that looked like this, it would set off some serious alarm bells, why is it OK in components?
+
+How do we stop our codebase from heading down this path? How can we define components from the start with clean boundaries to prevent the props from getting out of hand?
+
+Diamond UI sets strict rules for component responsibilities that solve future maintenance problems **now.**
+
+Components are grouped into one of the 4 Cs of UI, aiming to be concerned with fulfilling a single area of responsibility:
+
+- Content
+- Controls
+- Canvas
+- Composition
+
+Let’s dive in.
+
+
diff --git a/src/layouts/docs.webc b/src/layouts/docs.webc
index f582471..0b0e10b 100644
--- a/src/layouts/docs.webc
+++ b/src/layouts/docs.webc
@@ -37,7 +37,25 @@ layout: default.webc
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/styles/theme.css b/src/styles/theme.css
index 0c755e1..c7f662f 100644
--- a/src/styles/theme.css
+++ b/src/styles/theme.css
@@ -5,6 +5,7 @@
--diamond-theme-link-color: var(--color-blue-light);
--diamond-theme-border-color: var(--color-blue-dark);
--diamond-theme-background-muted: var(--color-blue-dark);
+ --diamond-theme-border-color-hover: var(--color-blue-light);
}
.theme-medium {
diff --git a/src/styles/util.css b/src/styles/util.css
index 4242197..af497e0 100644
--- a/src/styles/util.css
+++ b/src/styles/util.css
@@ -21,4 +21,8 @@
.fill {
display: grid;
height: 100%;
+}
+
+.text-title-case {
+ text-transform: capitalize;
}
\ No newline at end of file