Skip to content

Commit

Permalink
Merge branch 'master' into make-console-error-and-log-fail-tests-#2196
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Nov 15, 2017
2 parents 7c7773c + 969aadb commit 06e6f3c
Show file tree
Hide file tree
Showing 71 changed files with 1,870 additions and 696 deletions.
14 changes: 8 additions & 6 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ daysUntilStale: 45
daysUntilClose: 15
# Issues with these labels will never be considered stale
exemptLabels:
- bug
- 'help wanted'
- todo
- ready
- 'in progress'
- 'do not merge'
- 'needs review'
- 'high priority'

# Label to use when marking an issue as stale
staleLabel: inactive
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
Hi everyone! Seems like there hasn't been much going on in this issue lately.
If there are still questions, comments, or bugs, please feel free to continue
the discussion. We do try to do some housekeeping every once in a while so
inactive issues will get closed after 60 days. Thanks!
the discussion. Unfortunately, we don't have time to get to every issue. We
are always open to contributions so please send us a pull request if you would
like to help. Inactive issues will be closed after 60 days. Thanks!
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
Hey there, it's me again! I am going to help our maintainers close this issue
so they can focus on development efforts instead. If the issue mentioned is
Hey there, it's me again! I am going close this issue to help our maintainers
focus on the current development roadmap instead. If the issue mentioned is
still a concern, please open a new ticket and mention this old one. Cheers
and thanks for using Storybook!
1 change: 1 addition & 0 deletions addons/a11y/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../register';
47 changes: 47 additions & 0 deletions addons/a11y/.storybook/components/Button/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';
import PropTypes from 'prop-types';

const styles = {
button: {
padding: '12px 6px',
fontSize: '12px',
lineHeight: '16px',
borderRadius: '5px',
},
ok: {
backgroundColor: '#028402',
color: '#ffffff',
},
wrong: {
color: '#ffffff',
backgroundColor: '#4caf50',
}
}

function Button({ label, content, disabled, contrast }) {
return (
<button
style={{
...styles.button,
...styles[contrast],
}}
disabled={disabled}
>
{ content }
</button>
)
}

Button.propTypes = {
label: PropTypes.string,
content: PropTypes.string,
disabled: PropTypes.bool,
contrast: PropTypes.oneOf(['ok', 'wrong'])
};

Button.defaultProps = {
disabled: false,
contrast: 'ok',
};

export default Button;
34 changes: 34 additions & 0 deletions addons/a11y/.storybook/components/Button/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import { storiesOf } from '@storybook/react';

import { checkA11y } from './../../../src';

import Button from './component';

import Faker from 'faker';

const text = Faker.lorem.words();

storiesOf('<Button />', module)
.addDecorator(checkA11y)
.add('Default', () => (
<Button />
))
.add('Content', () => (
<Button content={text} />
))
.add('Label', () => (
<Button label={text} />
))
.add('Disabled', () => (
<Button
disabled
content={text}
/>
))
.add('Invalid contrast', () => (
<Button
contrast="wrong"
content={Faker.lorem.words()}
/>
));
22 changes: 22 additions & 0 deletions addons/a11y/.storybook/components/Form/components/Input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';

function Input({ id, value, type, placeholder }) {
return (
<input
id={id}
value={value}
placeholder={placeholder}
type={type}
/>
);
}

Input.propTypes = {
type: PropTypes.oneOf(['text', 'password']),
id: PropTypes.string,
value: PropTypes.string,
placeholder: PropTypes.string,
}

export default Input;
26 changes: 26 additions & 0 deletions addons/a11y/.storybook/components/Form/components/Label.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import PropTypes from 'prop-types';

const styles = {
label: {
padding: '0 6px',
},
}

function Label({ id, content }) {
return (
<label
style={styles.label}
htmlFor={id}
>
{ content }
</label>
)
}

Label.propTypes = {
content: PropTypes.string,
id: PropTypes.string,
};

export default Label;
21 changes: 21 additions & 0 deletions addons/a11y/.storybook/components/Form/components/Row.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';

import Label from './Label';
import Input from './Input';

function Row({ label, input }) {
return (
<div>
{label}
{input}
</div>
);
}

Row.propTypes = {
label: PropTypes.instanceOf(Label),
input: PropTypes.instanceOf(Input),
}

export default Row;
9 changes: 9 additions & 0 deletions addons/a11y/.storybook/components/Form/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Input from './Input';
import Label from './Label';
import Row from './Row';

export {
Input,
Label,
Row,
};
36 changes: 36 additions & 0 deletions addons/a11y/.storybook/components/Form/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';

import * as Form from './components';

import { storiesOf } from '@storybook/react';
import { checkA11y } from './../../../src';

import Faker from 'faker';

const label = Faker.lorem.word();
const placeholder = Faker.lorem.word();

storiesOf('<Form />', module)
.addDecorator(checkA11y)
.add('Without Label', () => (
<Form.Row
input={<Form.Input />}
/>
))
.add ('With label', () => (
<Form.Row
label={<Form.Label
content={label}
id="1"
/>}
input={<Form.Input id="1" />}
/>
))
.add ('With placeholder', () => (
<Form.Row
input={<Form.Input
id="1"
placeholder={placeholder}
/>}
/>
))
20 changes: 20 additions & 0 deletions addons/a11y/.storybook/components/Image/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import PropTypes from 'prop-types';

function Image({ src, alt, presentation }) {
return (
<img
src={src}
alt={alt}
role={presentation && 'presentation'}
/>
);
}

Image.propTypes = {
src: PropTypes.string.isRequired,
alt: PropTypes.string,
presentation: PropTypes.bool,
};

export default Image;
29 changes: 29 additions & 0 deletions addons/a11y/.storybook/components/Image/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import { storiesOf } from '@storybook/react';

import { checkA11y } from './../../../src';

import Image from './component';

import Faker from 'faker';

const image = Faker.image.animals();
const alt = Faker.lorem.words();

storiesOf('<Image />', module)
.addDecorator(checkA11y)
.add('Without alt', () => (
<Image src={image} />
))
.add('With alt', () => (
<Image
src={image}
alt={alt}
/>
))
.add('Presentation', () => (
<Image
presentation
src={image}
/>
));
24 changes: 24 additions & 0 deletions addons/a11y/.storybook/components/Typography/components/Heading.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { cloneElement } from 'react';
import PropTypes from 'prop-types';

const headings = {
1: (<h1 />),
2: (<h2 />),
3: (<h3 />),
4: (<h4 />),
};

function Heading({ level, children }) {
return cloneElement(headings[level], {}, children)
}

Heading.propTypes = {
level: PropTypes.oneOf([1, 2, 3, 4]),
children: PropTypes.any,
};

Heading.defaultProps = {
level: 1,
};

export default Heading;
17 changes: 17 additions & 0 deletions addons/a11y/.storybook/components/Typography/components/Link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';

function Link({ href, content }) {
return (
<a href={href}>
{ content }
</a>
);
}

Link.propTypes = {
href: PropTypes.string,
content: PropTypes.string,
};

export default Link;
16 changes: 16 additions & 0 deletions addons/a11y/.storybook/components/Typography/components/Text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import PropTypes from 'prop-types';

function Text({ children }) {
return (
<p>
{children}
</p>
);
}

Text.propTypes = {
children: PropTypes.any,
};

export default Text;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Heading from './Heading';
import Link from './Link';
import Text from './Text';

export {
Heading,
Link,
Text,
};
41 changes: 41 additions & 0 deletions addons/a11y/.storybook/components/Typography/stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import { storiesOf } from '@storybook/react';

import { checkA11y } from './../../../src';

import * as Typography from './components';

import Faker from 'faker';

const href = "javascript:void 0";

storiesOf('<Typography />', module)
.addDecorator(checkA11y)
.add('Correct', () => (
<div>
<Typography.Heading level={1}>
{Faker.lorem.sentence()}
</Typography.Heading>

<Typography.Text>
{Faker.lorem.paragraph()}
</Typography.Text>

<Typography.Link
content={`${Faker.lorem.words(4)}...`}
href={href}
/>
</div>
))
.add('Empty Heading', () => (
<Typography.Heading level={2} />
))
.add('Empty Paragraph', () => (
<Typography.Text />
))
.add('Empty Link', () => (
<Typography.Link href={href} />
))
.add('Link without href', () => (
<Typography.Link content={`${Faker.lorem.words(4)}...`} />
));

0 comments on commit 06e6f3c

Please sign in to comment.