feat(ui-toolkit): add syntax highlighting to styleguide

fixes #745
This commit is contained in:
Sara Vieira 2017-10-11 12:01:26 +01:00 committed by Sérgio Ramos
parent 4baf6647d5
commit a761b7da31
9 changed files with 30 additions and 38 deletions

View File

@ -86,4 +86,11 @@ p.rsg--p-32 {
.rsg--sidebar-4 :-moz-placeholder { /* Firefox 18- */ .rsg--sidebar-4 :-moz-placeholder { /* Firefox 18- */
color: #494949; color: #494949;
opacity: 0.5; opacity: 0.5;
} }
body .cm-s-base16-light.CodeMirror {
background: #fafafa;
color: #494949;
border-color: #d8d8d8;
padding: 9px 18px;
line-height: 16px;
}

View File

@ -1,6 +1,6 @@
### with text ### with text
``` ```jsx
<span> <span>
<Button>Inspire the lazy</Button> <Button>Inspire the lazy</Button>
<span> </span> <span> </span>
@ -10,7 +10,7 @@
### secondary ### secondary
``` ```jsx
<span> <span>
<Button secondary>Inspire the brave</Button> <Button secondary>Inspire the brave</Button>
<span> </span> <span> </span>
@ -20,7 +20,7 @@
### tertiary ### tertiary
``` ```jsx
<span> <span>
<Button tertiary>Inspire the tertiary</Button> <Button tertiary>Inspire the tertiary</Button>
<span> </span> <span> </span>
@ -32,7 +32,7 @@
### disabled ### disabled
``` ```jsx
<span> <span>
<Button disabled>Inspire the liars</Button> <Button disabled>Inspire the liars</Button>
<span> </span> <span> </span>

View File

@ -1,5 +1,6 @@
import styled from 'styled-components'; import styled from 'styled-components';
import React from 'react'; import React from 'react';
import remcalc from 'remcalc';
import BaseToggle from './base/toggle'; import BaseToggle from './base/toggle';
import Baseline from '../baseline'; import Baseline from '../baseline';
@ -20,6 +21,12 @@ const Li = styled.li`
const Ul = styled.ul` const Ul = styled.ul`
margin: 0; margin: 0;
padding: 0; padding: 0;
margin-bottom: ${remcalc(8)};
+ label {
margin-left: ${remcalc(26)};
font-size: ${remcalc(13)};
}
`; `;
const RadioItem = BaseInput(({ children, id, ...rest }) => ( const RadioItem = BaseInput(({ children, id, ...rest }) => (

View File

@ -63,29 +63,5 @@ const Label = require('./label').default;
You need to select one You need to select one
</FormMeta> </FormMeta>
</FormGroup> </FormGroup>
<Legend>You can also have validation in each radio button</Legend>
<FormGroup name='who-killed'>
<Legend>Who killed the radio star?</Legend>
<RadioList>
<Radio success name="five" value='video'>
<Label>Video</Label>
</Radio>
<FormMeta left success>
You are the best !
</FormMeta>
<Radio warning name="five" value='tv'>
<Label>TV</Label>
</Radio>
<FormMeta left warning>
Are you sure ?
</FormMeta>
<Radio error name="five" value='netflix'>
<Label>Netflix</Label>
</Radio>
<FormMeta left error>
No, sorry
</FormMeta>
</RadioList>
</FormGroup>
</div> </div>
``` ```

View File

@ -1,4 +1,4 @@
``` ```jsx
const { ToggleList } = require('./toggle'); const { ToggleList } = require('./toggle');
const FormGroup = require('./group').default; const FormGroup = require('./group').default;
const Legend = require('./legend').default; const Legend = require('./legend').default;
@ -14,7 +14,7 @@ const Legend = require('./legend').default;
#### Toggle > Disabled #### Toggle > Disabled
``` ```jsx
const { ToggleList } = require('./toggle'); const { ToggleList } = require('./toggle');
const FormGroup = require('./group').default; const FormGroup = require('./group').default;
const Legend = require('./legend').default; const Legend = require('./legend').default;

View File

@ -1,7 +1,7 @@
#### Success/Educational #### Success/Educational
``` ```jsx
const { Title, Description } = require('.'); const { Message, Title, Description } = require('.');
<Message> <Message>
<Title>Choosing deployment data center</Title> <Title>Choosing deployment data center</Title>
@ -11,8 +11,8 @@ const { Title, Description } = require('.');
#### Error #### Error
``` ```jsx
const { Title, Description } = require('.'); const { Message, Title, Description } = require('.');
<Message error> <Message error>
<Title>Choosing deployment data center</Title> <Title>Choosing deployment data center</Title>
@ -22,8 +22,8 @@ const { Title, Description } = require('.');
#### Warning #### Warning
``` ```jsx
const { Title, Description } = require('.'); const { Message, Title, Description } = require('.');
<Message warning> <Message warning>
<Title>Choosing deployment data center</Title> <Title>Choosing deployment data center</Title>

View File

@ -46,7 +46,7 @@ const Close = styled(CloseButton)`
top: ${unitcalc(0.5)}; top: ${unitcalc(0.5)};
`; `;
const Message = ({ onCloseClick, children, ...type }) => ( export const Message = ({ onCloseClick, children, ...type }) => (
<Container> <Container>
<Color {...type} /> <Color {...type} />
<Outlet>{children}</Outlet> <Outlet>{children}</Outlet>

View File

@ -3,6 +3,7 @@ import { ThemeProvider, injectGlobal } from 'styled-components';
import theme from '../theme'; import theme from '../theme';
import Base from '../base'; import Base from '../base';
import { loadedFontFamily } from '../typography'; import { loadedFontFamily } from '../typography';
import 'react-codemirror2/node_modules/codemirror/mode/jsx/jsx';
const StyledBase = Base.extend` const StyledBase = Base.extend`
/* trick prettier */ /* trick prettier */

View File

@ -5,6 +5,7 @@ const snapguidist = require('snapguidist');
const path = require('path'); const path = require('path');
module.exports = { module.exports = {
highlightTheme: 'base16-light',
require: [path.join(__dirname, 'etc/style.css')], require: [path.join(__dirname, 'etc/style.css')],
webpackConfig: Object.assign(webpackConfig, { webpackConfig: Object.assign(webpackConfig, {
resolve: Object.assign(webpackConfig.resolve, { resolve: Object.assign(webpackConfig.resolve, {