Skip to content

Commit ddead67

Browse files
author
chenyueban
committed
feat(config): Finally completed the compiled configuration
1 parent e34596d commit ddead67

23 files changed

Lines changed: 565 additions & 236 deletions

File tree

.eslintrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"browser": true,
44
"commonjs": true,
55
"es6": true,
6-
"node": true
6+
"node": true,
7+
"jest": true
78
},
89
"parser": "@typescript-eslint/parser",
910
"parserOptions": {
@@ -17,15 +18,17 @@
1718
"react",
1819
"react-hooks",
1920
"prettier",
20-
"@typescript-eslint"
21+
"@typescript-eslint",
22+
"jest"
2123
],
2224
"extends": [
2325
"eslint:recommended",
2426
"plugin:@typescript-eslint/recommended",
2527
"plugin:react/recommended",
2628
"plugin:prettier/recommended",
2729
"prettier/react",
28-
"prettier/@typescript-eslint"
30+
"prettier/@typescript-eslint",
31+
"plugin:jest/recommended"
2932
],
3033
"settings": {
3134
"react": {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"lint": "eslint --fix . && echo 'Lint complete.'",
99
"start": "lerna run start --parallel",
1010
"build": "lerna run build",
11+
"test": "lerna run test",
1112
"release": "lerna publish --force-publish @fluent-ui/core"
1213
},
1314
"devDependencies": {
@@ -22,7 +23,7 @@
2223
"husky": "^2.4.0",
2324
"lerna": "^3.14.1",
2425
"lint-staged": "^8.1.7",
25-
"prettier": "1.17.1",
26+
"prettier": "^1.17.1",
2627
"typescript": "^3.4.5"
2728
},
2829
"config": {

packages/fluent-ui.com/src/components/layout.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ import { StaticQuery, graphql } from 'gatsby'
1010

1111
import Header from './header'
1212

13+
import { ThemeProvider, Theme } from '@fluent-ui/core'
14+
1315
interface LayoutProps {
1416
children: ReactChild
1517
}
1618

19+
const theme: Theme = {
20+
colors: {
21+
// primary: 'rgba(0, 0, 0, 0.2)',
22+
// accent: 'rgba(0, 120, 215, 1)'
23+
}
24+
}
25+
1726
const Layout: SFC<LayoutProps> = ({ children }: LayoutProps): ReactElement => (
1827
<StaticQuery
1928
query={graphql`
@@ -25,17 +34,12 @@ const Layout: SFC<LayoutProps> = ({ children }: LayoutProps): ReactElement => (
2534
}
2635
}
2736
`}
28-
render={data => (
37+
render={(data): ReactElement => (
2938
<>
3039
<Header siteTitle={data.site.siteMetadata.title} />
31-
<div>
32-
<main>{children}</main>
33-
<footer>
34-
© {new Date().getFullYear()}, Built with
35-
{` `}
36-
<a href="https://www.gatsbyjs.org">Gatsby</a>
37-
</footer>
38-
</div>
40+
<main>{children}</main>
41+
{/* <ThemeProvider theme={theme}>
42+
</ThemeProvider> */}
3943
</>
4044
)}
4145
/>

packages/fluent-ui.com/src/docs/components/Button/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ Button default style
2222
Highlighted button
2323

2424
```jsx
25-
<Button accent>Accent</Button>
25+
<Button variant='accent'>Accent</Button>
2626
```

packages/fluent-ui/package.json

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
],
1111
"main": "build/umd/index.js",
1212
"module": "build/es/index.js",
13-
"files": [
14-
"dist"
15-
],
1613
"repository": {
1714
"type": "git",
1815
"url": "https://github.com/chenyueban/fluent-ui",
@@ -27,33 +24,40 @@
2724
"node": ">=8.0.0"
2825
},
2926
"scripts": {
30-
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
3127
"prebuild": "rimraf build",
32-
"build": "cross-env rollup -c rollup.config.js",
33-
"start": "rollup -c rollup.config.js -w",
28+
"build": "yarn build:cjs && yarn build:es && yarn build:umd",
29+
"build:cjs": "cross-env NODE_ENV=production tsc --module CommonJS --outDir ./build/cjs",
30+
"build:es": "cross-env NODE_ENV=production tsc --module ES6 --outDir ./build/es",
31+
"build:umd": "cross-env NODE_ENV=production tsc --module UMD --outDir ./build/umd",
32+
"start": "cross-env NODE_ENV=production tsc -w --module ES6 --outDir ./build/es",
3433
"test": "jest --coverage",
3534
"test:watch": "jest --coverage --watch",
36-
"test:prod": "npm run lint && npm run test -- --no-cache",
35+
"test:prod": "yarn test -- --no-cache",
3736
"codecov": "codecov"
3837
},
3938
"peerDependencies": {
40-
"react": "^16.8.0",
41-
"react-dom": "^16.8.0"
39+
"react": ">= 16.8.0",
40+
"react-dom": ">= 16.8.0",
41+
"styled-components": ">= 4.X"
42+
},
43+
"dependencies": {
44+
"styled-system": "^5.0.5"
4245
},
4346
"devDependencies": {
4447
"@types/jest": "^23.3.2",
4548
"@types/node": "^10.11.0",
49+
"@types/react": "^16.8.19",
50+
"@types/react-dom": "^16.8.4",
51+
"@types/styled-components": "4.1.8",
52+
"@types/styled-system": "^4.2.1",
4653
"codecov": "^3.5.0",
4754
"cross-env": "^5.2.0",
55+
"eslint-plugin-jest": "^22.6.4",
4856
"jest": "^23.6.0",
4957
"jest-config": "^23.6.0",
5058
"rimraf": "^2.6.2",
51-
"rollup": "^0.67.0",
52-
"rollup-plugin-commonjs": "^9.1.8",
53-
"rollup-plugin-json": "^3.1.0",
54-
"rollup-plugin-node-resolve": "^3.4.0",
55-
"rollup-plugin-sourcemaps": "^0.4.2",
56-
"rollup-plugin-typescript2": "^0.18.0",
59+
"styled-components": "^4.3.0",
60+
"styled-system": "^5.0.5",
5761
"ts-jest": "^23.10.2"
5862
},
5963
"jest": {

packages/fluent-ui/rollup.config.js

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

packages/fluent-ui/src/Button/Button.tsx

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import styled from 'styled-components'
2+
import { color, background, themeGet } from 'styled-system'
3+
import { theme } from '../../index'
4+
5+
interface StyledButtonProps {
6+
color: 'white' | 'black'
7+
bg: 'accent' | 'primary'
8+
}
9+
10+
const StyledButton = styled.button<StyledButtonProps>`
11+
${color}
12+
${background}
13+
`
14+
15+
StyledButton.defaultProps = {
16+
color: 'black'
17+
// bg: themeGet('variant.primary')({})
18+
}
19+
20+
export default StyledButton
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React, { SFC, ReactElement, ReactChild } from 'react'
2+
3+
import StyledButton from './Button.styled'
4+
5+
interface ButtonProps {
6+
variant?: 'primary' | 'accent'
7+
children: ReactChild
8+
}
9+
10+
const Button: SFC<ButtonProps> = ({
11+
variant = 'primary',
12+
children
13+
}: ButtonProps): ReactElement => {
14+
const color = variant === 'accent' ? 'white' : 'black'
15+
return (
16+
<StyledButton color={color} bg={variant}>
17+
{children}
18+
</StyledButton>
19+
)
20+
}
21+
22+
export default Button
File renamed without changes.

0 commit comments

Comments
 (0)