Skip to content

Commit

Permalink
feat: text stories
Browse files Browse the repository at this point in the history
  • Loading branch information
shrugs committed Jul 20, 2020
1 parent c03658e commit 062a302
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface ButtonState {
const transitionStyles = cn('transition-all duration-150');
const childStyles = cn('flex flex-row justify-center items-center');
const focusStyles = cn('focus:outline-none');
const textStyles = cn('whitespace-no-wrap select-none font-sans');
const textStyles = cn('whitespace-no-wrap select-none font-sans tracking-button');

const primaryButtonStyles = ({
disabled = false,
Expand Down
53 changes: 53 additions & 0 deletions src/components/Text/Text.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';
import { cn } from '../../utils/cn';
import { H1, H2, H3, H4, Text, BoldText, SubText, LinkText, SlugText } from './Text';
import { text } from '@storybook/addon-knobs';

export default {
title: 'Text',
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/oSYDK9EcHtXRJ4cTUK14nU/interface?node-id=1022%3A93340',
},
},
};

export const All = () => {
const child = text('Text', 'Hello World');
return (
<div className={cn('space-y-4')}>
<H3>Headings</H3>
<H1>{child}</H1>
<H2>{child}</H2>
<H3>{child}</H3>
<H4>{child}</H4>
<hr />
<H3>Text</H3>
<div className={cn('flex flex-row space-x-4')}>
<Text>{child}</Text>
<BoldText>{child}</BoldText>
<Text className={cn('italic')}>{child}</Text>
<Text className={cn('underline')}>{child}</Text>
</div>
<hr />
<H3>SubText</H3>
<div className={cn('flex flex-row space-x-4')}>
<SubText>{child}</SubText>
<SubText className={cn('font-bold')}>{child}</SubText>
<SubText className={cn('italic')}>{child}</SubText>
<SubText className={cn('underline')}>{child}</SubText>
</div>
<hr />
<H3>LinkText</H3>
<div className={cn('flex flex-row space-x-4')}>
<LinkText>{child}</LinkText>
</div>
<hr />
<H3>SlugText</H3>
<div className={cn('flex flex-row space-x-4')}>
<SlugText>{child}</SlugText>
</div>
</div>
);
};
2 changes: 0 additions & 2 deletions src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import makeBasicElement from '../util/makeBasicElement';
import { cn } from '../../utils/cn';

Expand All @@ -13,5 +12,4 @@ export const LinkText = makeBasicElement<HTMLAnchorElement>(
);
export const BoldText = makeBasicElement(Text, cn('font-bold'));
export const SubText = makeBasicElement(Text, cn('text-subtext'));

export const SlugText = makeBasicElement('code', cn('font-mono'));
3 changes: 3 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ module.exports = {
'48': '12rem',
'10xl': '120rem',
},
letterSpacing: {
button: '0.02em',
},
},
},
variants: {
Expand Down

1 comment on commit 062a302

@vercel
Copy link

@vercel vercel bot commented on 062a302 Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.