Skip to content

Commit 1852b9a

Browse files
🎉 Components Update 3.0.0
🎉 Components Update
2 parents ffac6aa + 9f9a90d commit 1852b9a

File tree

184 files changed

+10421
-13086
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+10421
-13086
lines changed

.github/workflows/main.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
7+
steps:
8+
- name: Begin CI...
9+
uses: actions/checkout@v2
10+
11+
- name: Use Node 12
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: 12.x
15+
16+
- name: Use cached node_modules
17+
uses: actions/cache@v1
18+
with:
19+
path: node_modules
20+
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
21+
restore-keys: |
22+
nodeModules-
23+
24+
- name: Install dependencies
25+
run: yarn install --frozen-lockfile
26+
env:
27+
CI: true
28+
29+
- name: Lint
30+
run: yarn lint
31+
env:
32+
CI: true
33+
34+
- name: Test
35+
run: yarn test --ci --coverage --maxWorkers=2
36+
env:
37+
CI: true
38+
39+
- name: Build
40+
run: yarn build
41+
env:
42+
CI: true

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
**/webpack.config.js
44
node_modules
55
src
6+
stories
67
example
78
lib
89
lib-esm
910
_bundles
11+
tsdx.config.js

.storybook/config.tsx

Lines changed: 0 additions & 46 deletions
This file was deleted.

.storybook/main.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
stories: ['../stories/**/*.stories.(ts|tsx|mdx)'],
3+
addons: [
4+
'@storybook/addon-actions',
5+
'@storybook/addon-links',
6+
'@storybook/addon-docs',
7+
'./.storybook/register.js'
8+
],
9+
webpackFinal: async config => {
10+
config.module.rules.push({
11+
test: /\.(ts|tsx)$/,
12+
use: [
13+
{
14+
loader: require.resolve('ts-loader'),
15+
options: {
16+
transpileOnly: true
17+
}
18+
},
19+
{
20+
loader: require.resolve('react-docgen-typescript-loader')
21+
}
22+
]
23+
})
24+
25+
config.resolve.extensions.push('.ts', '.tsx')
26+
27+
return config
28+
}
29+
}

.storybook/manager.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { addons } from '@storybook/addons'
2+
import committedTheme from './theme.js'
3+
4+
addons.setConfig({
5+
theme: committedTheme,
6+
showPanel: false
7+
})

.storybook/preview.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from 'react'
2+
import { addParameters, addDecorator } from '@storybook/react'
3+
import committedTheme from './theme.js'
4+
5+
import { ThemeProvider } from '../src'
6+
7+
addDecorator(storyFn => <ThemeProvider>{storyFn()}</ThemeProvider>)
8+
addParameters({
9+
options: {
10+
// Currently require here aswell as in manager.js - should be able to remove in 6.0
11+
theme: committedTheme,
12+
storySort: (a, b) => {
13+
if (a[0] === b[0]) {
14+
return 0
15+
}
16+
if (
17+
a[1].parameters &&
18+
a[1].parameters.order &&
19+
b[1].parameters &&
20+
b[1].parameters.order
21+
) {
22+
return a[1].parameters.order - b[1].parameters.order
23+
} else {
24+
return a[1].id.localeCompare(b[1].id, { numeric: true })
25+
}
26+
}
27+
}
28+
})
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import '@storybook/addon-docs/register'
2-
import '@storybook/addon-actions/register'
3-
import '@storybook/addon-links/register'
4-
import '@storybook/addon-a11y/register'
51
import { STORIES_CONFIGURED, STORY_MISSING } from '@storybook/core-events'
2+
import { addons } from '@storybook/addons'
63

7-
import addonAPI from '@storybook/addons'
8-
9-
addonAPI.register('committed/components', storybookAPI => {
4+
addons.register('committed/components', storybookAPI => {
105
storybookAPI.on(STORIES_CONFIGURED, (kind, story) => {
116
if (storybookAPI.getUrlState().path === '/story/*') {
127
storybookAPI.selectStory('Design System', 'Introduction')

.storybook/theme.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { create } from '@storybook/theming'
2+
import lightImage from '../public/images/Committed-Colour-512px.png'
3+
import darkImage from '../public/images/Committed-Yellow-Trans-512px.png'
4+
5+
// The default color scheme is light so unless the preferred color
6+
// scheme is set to dark we always want to use the light theme
7+
// from '@storybook/theming/src/utils'
8+
export const getPreferredColorScheme = () => {
9+
if (!window || !window.matchMedia) return 'light'
10+
11+
const isDarkThemePreferred = window.matchMedia('(prefers-color-scheme: dark)')
12+
.matches
13+
if (isDarkThemePreferred) return 'dark'
14+
15+
return 'light'
16+
}
17+
18+
console.log(lightImage)
19+
console.log(darkImage)
20+
21+
export default create({
22+
colorPrimary: '#ffbb00',
23+
colorSecondary: '#4098D7',
24+
25+
// Typography
26+
fontBase:
27+
'-apple-system, BlinkMacSystemFont, "San Francisco", Roboto, "Segoe UI", "Helvetica Neue"', // fonts.defaultFonts.typography.fontFamily,
28+
fontCode:
29+
'"SFMono-Regular", Consolas, "Liberation Mono", "Andale Mono", "Ubuntu Mono", Menlo, Courier, monospace', // fonts.defaultFonts.monospace.fontFamily,
30+
31+
brandTitle: 'Committed Components',
32+
brandUrl: '/',
33+
brandImage: getPreferredColorScheme() == 'light' ? lightImage : darkImage
34+
})

.storybook/tsconfig.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

.storybook/webpack.config.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)