Skip to content

Commit

Permalink
docs(website): improve docs and demo experience
Browse files Browse the repository at this point in the history
  • Loading branch information
preshonyee committed Jun 21, 2021
1 parent f09409f commit 92dfaf4
Show file tree
Hide file tree
Showing 43 changed files with 1,205 additions and 554 deletions.
30 changes: 6 additions & 24 deletions .storybook/theme-decorator.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,15 @@
import React from 'react';
import { DARK_THEME, styled } from '../src/stitches.config';
import { BrowserWindow } from '../src/components/browserWindow';
import { styled } from '../src/stitches.config';

const ThemeWrapper = styled('div', {
backgroundColor: '$bg_primary',
display: 'flex',
flexDirection: 'column',
justifyContent: 'flex-start',
alignItems: 'center',
px: '$4',
py: '$5',
width: '45.5%',
const Wrapper = styled('div', {
height: '100vh',
mb: '$4',
});

const ThemeDecorator = (storyFn: any) => (
<div
style={{
display: 'flex',
justifyContent: 'space-between',
}}
>
<ThemeWrapper className="light">
{storyFn({ id: id => 'light-' + id })}
</ThemeWrapper>
<ThemeWrapper className={DARK_THEME}>
{storyFn({ id: id => 'dark-' + id })}
</ThemeWrapper>
</div>
<Wrapper>
<BrowserWindow>{storyFn()}</BrowserWindow>
</Wrapper>
);

export default ThemeDecorator;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "camara",
"version": "1.0.0-beta.77",
"version": "1.0.0-beta.84",
"description": "A design system that helps you build your ideas quickly",
"author": {
"name": "Presh Onyee",
Expand Down
147 changes: 77 additions & 70 deletions src/components/avatar/avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { User } from 'react-feather';
import { Avatar, AvatarProps } from '.';
import { Box } from '../box';
import { Flex } from '../flex';
import { BrowserWindow } from '../browserWindow';

export default {
title: 'Components/Avatar',
Expand All @@ -27,76 +28,82 @@ Base.args = {

// types
export const Types = (args: AvatarProps) => (
<Box>
<Flex>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
size="large"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
size="medium"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
size="small"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
size="tiny"
/>
</Flex>
<Flex>
<Avatar {...args} size="large" icon={<User color="#777" size={64} />} />
<Avatar {...args} size="medium" icon={<User color="#777" size={48} />} />
<Avatar {...args} size="small" icon={<User color="#777" size={32} />} />
<Avatar {...args} size="tiny" icon={<User color="#777" size={24} />} />
</Flex>
<Flex>
<Avatar {...args} size="large" username="Sam" />
<Avatar {...args} size="medium" username="Sam" />
<Avatar {...args} size="small" username="Sam" />
<Avatar {...args} size="tiny" username="Sam" />
</Flex>
<Flex>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
stories
size="large"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
stories
size="medium"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
stories
size="small"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
stories
size="tiny"
/>
</Flex>
</Box>
<BrowserWindow>
<Box>
<Flex>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
size="large"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
size="medium"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
size="small"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
size="tiny"
/>
</Flex>
<Flex>
<Avatar {...args} size="large" icon={<User color="#777" size={64} />} />
<Avatar
{...args}
size="medium"
icon={<User color="#777" size={48} />}
/>
<Avatar {...args} size="small" icon={<User color="#777" size={32} />} />
<Avatar {...args} size="tiny" icon={<User color="#777" size={24} />} />
</Flex>
<Flex>
<Avatar {...args} size="large" username="Sam" />
<Avatar {...args} size="medium" username="Sam" />
<Avatar {...args} size="small" username="Sam" />
<Avatar {...args} size="tiny" username="Sam" />
</Flex>
<Flex>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
stories
size="large"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
stories
size="medium"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
stories
size="small"
/>
<Avatar
{...args}
imageSrc="https://source.unsplash.com/200x200/?shiba-inu"
imageAlt="portrait of Shiba Inu"
stories
size="tiny"
/>
</Flex>
</Box>
</BrowserWindow>
);

// sizes
Expand Down
3 changes: 0 additions & 3 deletions src/components/box/box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export interface BoxProps extends HTMLAttributes<HTMLDivElement> {
}

const StyledBox: any = styled('div', {
boxSizing: 'border-box',
minWidth: 0,
display: 'block',
variants: {
center: {
true: {
Expand Down
149 changes: 149 additions & 0 deletions src/components/browserWindow/browserChrome.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
import React from 'react';
import { styled } from '../../stitches.config';
import {
ChevronLeft,
ChevronRight,
Layout,
Padlock,
Plus,
Refresh,
Share,
Shield,
Tabs,
TrafficLight,
} from './icons';

const Container = styled('div', {
display: 'flex',
padding: '$2',
flex: 1,
borderTopLeftRadius: '$3',
borderTopRightRadius: '$3',
});

const AddressBar = styled('div', {
py: '2px',
px: '$2',
display: 'flex',
flex: 1,
justifyContent: 'space-between',
alignItems: 'center',
borderRadius: '$2',
'& small': {
ml: '$1',
},
'& .url': {
display: 'flex',
alignItems: 'center',
},
'& .lock > *': {
width: '10px',
height: '10px',
},
'& .refresh > *': {
width: '12px',
height: '12px',
},
});

const LeftSide = styled('div', {
flex: 1,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
'& .left': {
display: 'flex',
},
'& .traffic_light > *': {
mx: '$2',
width: '36px',
height: '14px',
},
'& .chevrons > *': {
mx: '$2',
width: '8px',
height: '12px',
},
'& .layout > *': {
mx: '$3',
width: '16px',
height: '12px',
},
'& .shield > *': {
mx: '$3',
width: '14px',
height: '14px',
},
});
const RightSide = styled('div', {
flex: 1,
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'center',
'& > *': {
mx: '$2',
width: '12px',
height: '12px',
},
});

interface IChrome {
theme?: 'light' | 'dark';
}

export const BrowserChrome = ({ theme }: IChrome) => {
return (
<Container
css={{
backgroundColor:
theme === 'dark'
? 'rgba(38, 43, 47, 0.53)'
: 'rgba(255, 255, 255, 0.78)',
}}
>
<LeftSide>
<div className="left">
<span className="traffic_light">
<TrafficLight />
</span>
<span className="layout">
<Layout theme={theme} />
</span>
<span className="chevrons">
<ChevronLeft theme={theme} />
<ChevronRight theme={theme} />
</span>
</div>
<span className="shield">
<Shield theme={theme} />
</span>
</LeftSide>

<AddressBar
css={{
backgroundColor:
theme === 'dark' ? 'rgba(66, 75, 82, 0.18)' : 'rgba(0, 0, 0, 0.05)',
}}
>
<span></span>
<div className="url">
<span className="lock">
<Padlock theme={theme} />
</span>
<small style={{ color: theme === 'dark' ? '#ccc' : '#000' }}>
camara.space
</small>
</div>
<span className="refresh">
<Refresh theme={theme} />
</span>
</AddressBar>

<RightSide>
<Share theme={theme} />
<Plus theme={theme} />
<Tabs theme={theme} />
</RightSide>
</Container>
);
};
Loading

0 comments on commit 92dfaf4

Please sign in to comment.