Skip to content

Commit fe5ad29

Browse files
authored
Merge pull request #5 from user-interviews/feature/UIDS-4-reorganize-scss
UIDS-4 reorganize scss files under src
2 parents 684cb8d + 10b8aa0 commit fe5ad29

File tree

10 files changed

+162
-7
lines changed

10 files changed

+162
-7
lines changed

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@
121121
"prefer-destructuring": "warn",
122122
"quotes": ["error", "single", { "allowTemplateLiterals" : true }],
123123
"radix": 0,
124-
"symbol-description": 0
124+
"symbol-description": 0,
125+
"template-curly-spacing": "off",
126+
"indent": "off"
125127
}
126128
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.0",
44
"dependencies": {
55
"bootstrap": "^4.3.1",
6+
"classnames": "^2.2.6",
67
"node-sass": "^4.13.1",
78
"polished": "^3.4.2",
89
"prop-types": "^15.7.2",
@@ -11,7 +12,7 @@
1112
"react-dom": "^16.12.0"
1213
},
1314
"scripts": {
14-
"build": "NODE_ENV=production babel src --out-dir lib",
15+
"build": "NODE_ENV=production babel src --out-dir lib --copy-files",
1516
"lint": "eslint . --ext .js,.jsx",
1617
"storybook": "start-storybook -p 9009 -s public",
1718
"build-storybook": "build-storybook -s public",

scss/typography.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
$font-family: Lato, Arial, sans-serif;
22
$font-size-base: .875rem;
3+
$font-weight-bold: 700;

spec/__snapshots__/Storyshots.test.js.snap

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Storyshots Design System|Card all cards 1`] = `
3+
exports[`Storyshots Design System/Card all cards 1`] = `
44
<div>
55
<div
66
className="card"
@@ -20,3 +20,67 @@ exports[`Storyshots Design System|Card all cards 1`] = `
2020
</div>
2121
</div>
2222
`;
23+
24+
exports[`Storyshots Design System/Pill Blue 1`] = `
25+
<div
26+
style={
27+
Object {
28+
"padding": "1rem",
29+
}
30+
}
31+
>
32+
<div
33+
className="Pill Pill--blue"
34+
>
35+
Test pill
36+
</div>
37+
</div>
38+
`;
39+
40+
exports[`Storyshots Design System/Pill Default 1`] = `
41+
<div
42+
style={
43+
Object {
44+
"padding": "1rem",
45+
}
46+
}
47+
>
48+
<div
49+
className="Pill"
50+
>
51+
Test pill
52+
</div>
53+
</div>
54+
`;
55+
56+
exports[`Storyshots Design System/Pill Orange 1`] = `
57+
<div
58+
style={
59+
Object {
60+
"padding": "1rem",
61+
}
62+
}
63+
>
64+
<div
65+
className="Pill Pill--orange"
66+
>
67+
Test pill
68+
</div>
69+
</div>
70+
`;
71+
72+
exports[`Storyshots Design System/Pill Small 1`] = `
73+
<div
74+
style={
75+
Object {
76+
"padding": "1rem",
77+
}
78+
}
79+
>
80+
<div
81+
className="Pill Pill--sm"
82+
>
83+
Test pill
84+
</div>
85+
</div>
86+
`;
File renamed without changes.

src/Pill/Pill.jsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import classNames from 'classnames';
4+
5+
import './Pill.scss';
6+
7+
const Pill = ({ color, size, text }) => (
8+
<div
9+
className={
10+
classNames(
11+
'Pill',
12+
{ [`Pill--${color}`]: !!color },
13+
{ [`Pill--${size}`]: !!size },
14+
)
15+
}
16+
>
17+
{text}
18+
</div>
19+
);
20+
21+
Pill.propTypes = {
22+
color: PropTypes.string,
23+
size: PropTypes.string,
24+
text: PropTypes.string.isRequired,
25+
};
26+
27+
Pill.defaultProps = {
28+
color: undefined,
29+
size: undefined,
30+
};
31+
32+
export default Pill;

src/Pill/Pill.scss

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@import '../../scss/theme';
2+
3+
.Pill {
4+
display: inline;
5+
font-weight: $font-weight-bold;
6+
7+
//////// COLORS!
8+
// Default color is gray and sadddddd
9+
background-color: $ux-gray-200;
10+
color: $ux-gray-800;
11+
12+
&--blue {
13+
background-color: $ux-blue-100;
14+
color: $ux-blue-500;
15+
}
16+
17+
&--orange {
18+
background-color: $ux-orange-100;
19+
color: $ux-orange-600;
20+
}
21+
22+
/////// SIZES
23+
// Seems like a fine default size
24+
border-radius: 2rem;
25+
font-size: $font-size-base;
26+
padding: .5rem .75rem;
27+
28+
&--sm {
29+
border-radius: 1rem;
30+
font-size: .625rem;
31+
padding: .25rem .5rem;
32+
}
33+
}

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
import Card from './Card';
1+
import Card from './Card/Card';
2+
import Pill from './Pill/Pill';
23

3-
export { Card };
4+
export { Card, Pill };

stories/Card.stories.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import React from 'react';
22
import { withA11y } from '@storybook/addon-a11y';
33
import { withKnobs, text } from '@storybook/addon-knobs';
44

5-
import Card from '../src/Card';
5+
import Card from '../src/Card/Card';
66

77
import 'bootstrap/dist/css/bootstrap.min.css';
88
import '../scss/global.scss';
99

1010
export default {
11-
title: 'Design System|Card',
11+
title: 'Design System/Card',
1212
component: Card,
1313
decorators: [withA11y, withKnobs],
1414
};

stories/Pill.stories.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import { withA11y } from '@storybook/addon-a11y';
3+
import { withKnobs, text } from '@storybook/addon-knobs';
4+
5+
import Pill from '../src/Pill/Pill';
6+
7+
const withPadding = (story) => <div style={{ padding: '1rem' }}>{story()}</div>;
8+
9+
export default {
10+
title: 'Design System/Pill',
11+
component: Pill,
12+
decorators: [withA11y, withKnobs, withPadding],
13+
};
14+
15+
export const Default = () => <Pill text={text('Pill Text', 'Test pill')} />;
16+
17+
export const Blue = () => <Pill color="blue" text={text('Pill Text', 'Test pill')} />;
18+
19+
export const Orange = () => <Pill color="orange" text={text('Pill Text', 'Test pill')} />;
20+
21+
export const Small = () => <Pill size="sm" text={text('Pill Text', 'Test pill')} />;

0 commit comments

Comments
 (0)