Skip to content

Commit

Permalink
Remove old fill-canvas theme preview technique
Browse files Browse the repository at this point in the history
  • Loading branch information
tylersticka committed May 14, 2021
1 parent 2bb317f commit 762b545
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 69 deletions.
8 changes: 2 additions & 6 deletions src/components/button/button.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Story, Canvas, Meta } from '@storybook/addon-docs/blocks';
import elementsDemo from './demo/elements.twig';
import stylesDemo from './demo/styles.twig';
import stylesDarkDemo from './demo/styles-dark.twig';

<Meta
title="Components/Button"
Expand Down Expand Up @@ -35,10 +34,7 @@ Some buttons may not require as much emphasis as others. The `c-button--secondar
All the above visual styles will appear slightly different within [our dark theme](/?path=/docs/themes--dark). These versions retain their visual emphasis relative to one another while remaining visually distinct from form inputs.

<Canvas>
<Story
name="Styles (Dark)"
parameters={{ themes: { disable: true }, paddings: { disabled: true } }}
>
{(args) => stylesDarkDemo(args)}
<Story name="Styles (Dark)" parameters={{ theme: 't-dark' }}>
{(args) => stylesDemo(args)}
</Story>
</Canvas>
5 changes: 0 additions & 5 deletions src/components/button/demo/styles-dark.twig

This file was deleted.

16 changes: 0 additions & 16 deletions src/design/demo/fill-canvas.twig

This file was deleted.

54 changes: 25 additions & 29 deletions src/design/demo/theme.twig
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
{% extends '@cloudfour/design/demo/fill-canvas.twig' %}

{% block content %}
{% embed '@cloudfour/objects/rhythm/rhythm.twig' with {
class: 'o-rhythm--generous'
} %}
{% block content %}
<h1>t-{{theme}}</h1>
{% include '@cloudfour/design/typography/demo/inline-elements.twig' only %}
{% include '@cloudfour/components/button/demo/styles.twig' only %}
{# TODO: Replace padding and corner modifiers once card component can
handle these variations natively #}
{% set _card_class = 'c-card--horizontal@m u-pad-1 u-rounded' %}
{% if theme == 'light' %}
{% set _card_class = _card_class ~ ' t-dark' %}
{% else %}
{% set _card_class = _card_class ~ ' t-light' %}
{% endif %}
{% include '@cloudfour/components/card/demo/single.twig' with {
class: _card_class,
href: '#',
show_heading: true,
show_content: true,
show_cover: true,
show_footer: true
} only %}
{% endblock %}
{% endembed %}
{% endblock %}
{% embed '@cloudfour/objects/rhythm/rhythm.twig' with {
class: 'o-rhythm--generous'
} %}
{% block content %}
<h1>t-{{theme}}</h1>
{% include '@cloudfour/design/typography/demo/inline-elements.twig' only %}
{% include '@cloudfour/components/button/demo/styles.twig' only %}
{# TODO: Replace padding and corner modifiers once card component can
handle these variations natively #}
{% set _card_class = 'c-card--horizontal@m u-pad-1 u-rounded' %}
{% if theme == 'light' %}
{% set _card_class = _card_class ~ ' t-dark' %}
{% else %}
{% set _card_class = _card_class ~ ' t-light' %}
{% endif %}
{% include '@cloudfour/components/card/demo/single.twig' with {
class: _card_class,
href: '#',
show_heading: true,
show_content: true,
show_cover: true,
show_footer: true
} only %}
{% endblock %}
{% endembed %}
18 changes: 5 additions & 13 deletions src/design/themes.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,7 @@ import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
import demo from './demo/theme.twig';
const demoStory = (args) => demo(args);

<Meta
title="Design/Themes"
parameters={{ themes: { disable: true }, paddings: { disabled: true } }}
argTypes={{
theme: {
type: { name: 'string' },
control: { type: 'inline-radio', options: ['light', 'dark'] },
defaultValue: 'light',
},
}}
/>
<Meta title="Design/Themes" />

# Themes

Expand All @@ -23,15 +13,17 @@ Themes may be applied to a containing element to change that content's appearanc
The default theme, applied to the document `:root` by default.

<Canvas>
<Story name="Light">{demoStory.bind({})}</Story>
<Story name="Light" args={{ theme: 'light' }}>
{demoStory.bind({})}
</Story>
</Canvas>

## Dark

Optimized for page intros and headings.

<Canvas>
<Story name="Dark" args={{ theme: 'dark' }}>
<Story name="Dark" parameters={{ theme: 't-dark' }} args={{ theme: 'dark' }}>
{demoStory.bind({})}
</Story>
</Canvas>
Expand Down

0 comments on commit 762b545

Please sign in to comment.