diff --git a/docs/codeExamples/customisation/index.tsx b/docs/codeExamples/customisation/index.tsx new file mode 100644 index 0000000..627d91c --- /dev/null +++ b/docs/codeExamples/customisation/index.tsx @@ -0,0 +1 @@ +export { systemExtensionUsage } from '../customisation/systemExtensionUsage'; diff --git a/docs/codeExamples/generator/systemExtensionUsage.ts b/docs/codeExamples/customisation/systemExtensionUsage.ts similarity index 89% rename from docs/codeExamples/generator/systemExtensionUsage.ts rename to docs/codeExamples/customisation/systemExtensionUsage.ts index a4f36af..0801948 100644 --- a/docs/codeExamples/generator/systemExtensionUsage.ts +++ b/docs/codeExamples/customisation/systemExtensionUsage.ts @@ -1,5 +1,6 @@ export const systemExtensionUsage = ` import { system } from 'styled-system'; + import { Property } from 'csstype'; import { createStyledComponent, createBaseComponents } from 'artifak'; import { Theme, RequiredTheme, ResponsiveValue } from 'styled-system'; @@ -8,7 +9,7 @@ export const systemExtensionUsage = ` // You will find most of what you need via @types/styled-system but if you don't // well... here's an example of making your own. export interface TextDecorationProps { - textDecoration?: ResponsiveValue; + textDecoration?: ResponsiveValue; } // add your prop via "system" @@ -19,7 +20,9 @@ export const systemExtensionUsage = ` // Create the styled component. // In this example, we're assuming we want to generate a bunch of components from this base. - const MyBaseComponent = createStyledComponent([myStylesConfig]); + const MyBaseComponent = createStyledComponent( + {}, {}, [myStylesConfig] + ); const myStyles = { Component1: { diff --git a/docs/codeExamples/generator/createBaseComponentsUsage.ts b/docs/codeExamples/generator/createBaseComponentsUsage.ts index 2fc9774..887cd36 100644 --- a/docs/codeExamples/generator/createBaseComponentsUsage.ts +++ b/docs/codeExamples/generator/createBaseComponentsUsage.ts @@ -4,9 +4,7 @@ export const createBaseComponentsUsage = ` // Create your base component const BaseComponent = createStyledComponent( - [position], - { position: 'relative' }, - 'article' + { position: 'relative' }, {}, [position], 'article' ); // Define your styles diff --git a/docs/codeExamples/generator/createStyledComponentUsage.ts b/docs/codeExamples/generator/createStyledComponentUsage.ts index b1d6127..2d9b985 100644 --- a/docs/codeExamples/generator/createStyledComponentUsage.ts +++ b/docs/codeExamples/generator/createStyledComponentUsage.ts @@ -2,8 +2,6 @@ export const createStyledComponentUsage = ` import { position, PositionProps } from 'styled-system'; const StyledArticle = createStyledComponent( - [position], - { position: 'relative' }, - 'article' + { position: 'relative' }, {}, [position], 'article' ); `; diff --git a/docs/codeExamples/generator/index.tsx b/docs/codeExamples/generator/index.tsx index ac9760b..1a185ed 100644 --- a/docs/codeExamples/generator/index.tsx +++ b/docs/codeExamples/generator/index.tsx @@ -1,3 +1,2 @@ export { createStyledComponentUsage } from './createStyledComponentUsage'; export { createBaseComponentsUsage } from './createBaseComponentsUsage'; -export { systemExtensionUsage } from './systemExtensionUsage'; diff --git a/docs/components/FlexTable.tsx b/docs/components/FlexTable.tsx index ce52048..9923630 100644 --- a/docs/components/FlexTable.tsx +++ b/docs/components/FlexTable.tsx @@ -8,7 +8,12 @@ import { SmallParagraph } from '../components/Typography'; -export function FlexTable({ title, cells }) { +type Props = { + title?: string; + cells: { prop: string; content: string }[]; +}; + +export function FlexTable({ title, cells }: Props) { return ( - + {!!title && } {!!cells && cells.length && diff --git a/docs/components/Header/index.tsx b/docs/components/Header/index.tsx index 4205e44..6036caa 100644 --- a/docs/components/Header/index.tsx +++ b/docs/components/Header/index.tsx @@ -58,6 +58,12 @@ const links = [ title: 'Variants', selected: false, key: 'modules' + }, + { + id: 'customisation', + title: 'Customisation', + selected: false, + key: 'modules' } ]; diff --git a/docs/containers/Customisation.tsx b/docs/containers/Customisation.tsx new file mode 100644 index 0000000..39b0ca1 --- /dev/null +++ b/docs/containers/Customisation.tsx @@ -0,0 +1,33 @@ +import { Paragraph, Strong } from '../components/Typography'; +import { Syntax } from '../components/Syntax'; + +import { systemExtensionUsage } from '../codeExamples/customisation'; + +import { HR } from '../components/HR'; +import { ArticleDoc } from '../components/ArticleDoc'; +import { ArticleSubSectionTitle } from '../components/ArticleSubSectionTitle'; + +export function Customisation() { + return ( + + + + ); +} + +export function CustomisationContent() { + return ( + <> + + Customising/Adding CSS properties + + + + To add to the previous createBaseComponents components example, let's + say you'd like to extend the system with some extra CSS properties. + + + {systemExtensionUsage} + + ); +} diff --git a/docs/containers/Media.tsx b/docs/containers/Media.tsx index fe855a4..b7c692e 100644 --- a/docs/containers/Media.tsx +++ b/docs/containers/Media.tsx @@ -1,4 +1,4 @@ -import { Paragraph } from '../components/Typography'; +import { Paragraph, Strong } from '../components/Typography'; import { Syntax } from '../components/Syntax'; import { min, max, minMax, and, or, single } from '../codeExamples/media'; import { ArticleSubSectionTitle } from '../components/ArticleSubSectionTitle'; @@ -19,9 +19,12 @@ export function MediaContent() { return ( <> - A styled-component mixin, Media helps you write media queries for your - styled components. At its current incarnation, the mixin supports "and" - and "or" media query operators. The "not" operator is not supported yet. + Although most width related queries should be taken care of via Styled + System, sometimes our concern goes beyond that and what's more, there + are currently newer media queries that we can specify now. Therefore, a + media query mixin is included with Artifak to help in regards to this. + At its current incarnation, the mixin only supports "and" and "or" media + query operators. The "not" operator is not supported yet.
@@ -35,7 +38,6 @@ export function MediaContent() { - Returns an equivalent of "@media (width: 768px)" + + Returns an equivalent of "@media (width: 768px)" + {single}
- Returns an equivalent of "@media (min-width: 768px)" + Returns an equivalent of "@media (min-width: 768px)" {min} @@ -224,7 +224,7 @@ export function MediaContent() { - Returns an equivalent of "@media (max-width: 768px)" + Returns an equivalent of "@media (max-width: 768px)" {max} @@ -232,8 +232,8 @@ export function MediaContent() { - Returns an equivalent of "@media (min-width: 768px) and (max-width: - 1200px)" + Returns an equivalent of{' '} + "@media (min-width: 768px) and (max-width: 1200px)" {minMax} @@ -243,7 +243,7 @@ export function MediaContent() { To formulate queries with the "and" operator, simply add your query to the same query object. Below will formulate a query equivalent to: - "@media screen and (min-width: 768px)" + "@media screen and (min-width: 768px)" {and} @@ -252,8 +252,10 @@ export function MediaContent() { To formulate queries with the "or" operator, simply add another query - object as argument. Below will formulate a query equivalent to: "@media - screen and (min-width: 768px), (orientation: landscape)" + object as argument. Below will formulate a query equivalent to:{' '} + + "@media screen and (min-width: 768px), (orientation: landscape)" + {or} diff --git a/docs/containers/Variants.tsx b/docs/containers/Variants.tsx index ae187e3..4689804 100644 --- a/docs/containers/Variants.tsx +++ b/docs/containers/Variants.tsx @@ -21,7 +21,9 @@ export function VariantsContent() { For occasions that you want to create components and include variants - with them, you can turn to the Generator library to do so. + with them, you can use the createStyledComponent utility function to do + so and after you can use the createBaseComponents to generate off of + your newly created base Styled Component if you wish to. {generateWithVariants} diff --git a/docs/containers/index.tsx b/docs/containers/index.tsx index b4f96bc..c4a7db9 100644 --- a/docs/containers/index.tsx +++ b/docs/containers/index.tsx @@ -7,6 +7,7 @@ import { Generator } from './Generator'; import { Imagery } from './Imagery'; import { Media } from './Media'; import { Variants } from './Variants'; +import { Customisation } from './Customisation'; export const content = { Introduction, @@ -17,5 +18,6 @@ export const content = { Generator, Imagery, Media, - Variants + Variants, + Customisation };