Skip to content

Commit a573f06

Browse files
committed
feat: initial commit
0 parents  commit a573f06

Some content is hidden

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

44 files changed

+28953
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build/
2+
dist/
3+
node_modules/
4+
.snapshots/
5+
*.min.js

.eslintrc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"standard",
5+
"standard-react",
6+
"plugin:prettier/recommended",
7+
"prettier/standard",
8+
"prettier/react",
9+
"plugin:@typescript-eslint/eslint-recommended"
10+
],
11+
"env": {
12+
"node": true
13+
},
14+
"parserOptions": {
15+
"ecmaVersion": 2020,
16+
"ecmaFeatures": {
17+
"legacyDecorators": true,
18+
"jsx": true
19+
}
20+
},
21+
"settings": {
22+
"react": {
23+
"version": "16"
24+
}
25+
},
26+
"rules": {
27+
"space-before-function-paren": 0,
28+
"react/prop-types": 0,
29+
"react/jsx-handler-names": 0,
30+
"react/jsx-fragments": 0,
31+
"react/no-unused-prop-types": 0,
32+
"import/export": 0
33+
}
34+
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# dependencies
2+
node_modules
3+
/.pnp
4+
.pnp.js
5+
6+
dist

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 80,
3+
"semi": false,
4+
"singleQuote": true,
5+
"trailingComma": "es5",
6+
"tabWidth": 2
7+
}

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
node_js:
3+
- 12
4+
- 10

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# @solved-ac/ui-react
2+
3+
> React component library used by solved.ac
4+
5+
[![NPM](https://img.shields.io/npm/v/@solved-ac/ui-react.svg)](https://www.npmjs.com/package/@solved-ac/ui-react) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6+
7+
## Install
8+
9+
```bash
10+
npm install --save @solved-ac/ui-react
11+
```
12+
13+
## Usage
14+
15+
```tsx
16+
import React, { Component } from 'react'
17+
18+
import MyComponent from '@solved-ac/ui-react'
19+
import '@solved-ac/ui-react/dist/index.css'
20+
21+
class Example extends Component {
22+
render() {
23+
return <MyComponent />
24+
}
25+
}
26+
```
27+
28+
## License
29+
30+
MIT © [shiftpsh](https://github.com/shiftpsh)

example/.storybook/main.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
3+
addons: [
4+
'@storybook/addon-links',
5+
'@storybook/addon-essentials',
6+
'@storybook/addon-interactions',
7+
'@storybook/preset-create-react-app',
8+
'storybook-addon-styled-component-theme/dist/preset'
9+
],
10+
framework: '@storybook/react'
11+
}

example/.storybook/preview-head.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<link rel="stylesheet" as="style" crossorigin href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />

example/.storybook/preview.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { addDecorator } from '@storybook/react'
2+
import { withThemesProvider } from 'storybook-addon-styled-component-theme'
3+
import { ThemeProvider } from 'styled-components'
4+
import { Light, Dark } from '@solved-ac/ui-react'
5+
6+
export const parameters = {
7+
actions: { argTypesRegex: '^on[A-Z].*' },
8+
controls: {
9+
matchers: {
10+
color: /(background|color)$/i,
11+
date: /Date$/
12+
}
13+
}
14+
}
15+
16+
const themes = [Light, Dark]
17+
addDecorator(withThemesProvider(themes), ThemeProvider)

example/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This example was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
It is linked to the @solved-ac/ui-react package in the parent directory for development purposes.
4+
5+
You can run `yarn install` and then `yarn start` to test your package.

example/package.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"name": "@solved-ac/ui-react-example",
3+
"homepage": ".",
4+
"version": "0.0.0",
5+
"private": true,
6+
"scripts": {
7+
"start": "node ../node_modules/react-scripts/bin/react-scripts.js start",
8+
"build": "node ../node_modules/react-scripts/bin/react-scripts.js build",
9+
"test": "node ../node_modules/react-scripts/bin/react-scripts.js test",
10+
"eject": "node ../node_modules/react-scripts/bin/react-scripts.js eject",
11+
"storybook": "start-storybook -p 6006 -s public",
12+
"build-storybook": "build-storybook -s public"
13+
},
14+
"dependencies": {
15+
"@solved-ac/ui-react": "link:..",
16+
"@testing-library/jest-dom": "link:../node_modules/@testing-library/jest-dom",
17+
"@testing-library/react": "link:../node_modules/@testing-library/react",
18+
"@testing-library/user-event": "link:../node_modules/@testing-library/user-event",
19+
"@types/jest": "link:../node_modules/@types/jest",
20+
"@types/node": "link:../node_modules/@types/node",
21+
"@types/react": "link:../node_modules/@types/react",
22+
"@types/react-dom": "link:../node_modules/@types/react-dom",
23+
"react": "link:../node_modules/react",
24+
"react-dom": "link:../node_modules/react-dom",
25+
"react-scripts": "link:../node_modules/react-scripts",
26+
"typescript": "link:../node_modules/typescript"
27+
},
28+
"devDependencies": {
29+
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
30+
"@storybook/addon-actions": "^6.4.22",
31+
"@storybook/addon-essentials": "^6.4.22",
32+
"@storybook/addon-interactions": "^6.4.22",
33+
"@storybook/addon-links": "^6.4.22",
34+
"@storybook/node-logger": "^6.4.22",
35+
"@storybook/preset-create-react-app": "^3.2.0",
36+
"@storybook/react": "^6.4.22",
37+
"@storybook/testing-library": "^0.0.11"
38+
},
39+
"eslintConfig": {
40+
"extends": "react-app",
41+
"overrides": [
42+
{
43+
"files": [
44+
"**/*.stories.*"
45+
],
46+
"rules": {
47+
"import/no-anonymous-default-export": "off"
48+
}
49+
}
50+
]
51+
},
52+
"browserslist": {
53+
"production": [
54+
">0.2%",
55+
"not dead",
56+
"not op_mini all"
57+
],
58+
"development": [
59+
"last 1 chrome version",
60+
"last 1 firefox version",
61+
"last 1 safari version"
62+
]
63+
}
64+
}

example/public/favicon.ico

3.78 KB
Binary file not shown.

example/public/index.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta
7+
name="viewport"
8+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
9+
/>
10+
<meta name="theme-color" content="#000000" />
11+
12+
<!--
13+
manifest.json provides metadata used when your web app is added to the
14+
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
15+
-->
16+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
17+
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>@solved-ac/ui-react</title>
28+
</head>
29+
30+
<body>
31+
<noscript>
32+
You need to enable JavaScript to run this app.
33+
</noscript>
34+
35+
<div id="root"></div>
36+
37+
<!--
38+
This HTML file is a template.
39+
If you open it directly in the browser, you will see an empty page.
40+
41+
You can add webfonts, meta tags, or analytics to this file.
42+
The build step will place the bundled scripts into the <body> tag.
43+
44+
To begin the development, run `npm start` or `yarn start`.
45+
To create a production bundle, use `npm run build` or `yarn build`.
46+
-->
47+
</body>
48+
</html>

example/public/manifest.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "@solved-ac/ui-react",
3+
"name": "@solved-ac/ui-react",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

example/src/App.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
import App from './App'
4+
5+
it('renders without crashing', () => {
6+
const div = document.createElement('div')
7+
ReactDOM.render(<App />, div)
8+
ReactDOM.unmountComponentAtNode(div)
9+
})

example/src/App.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import '@solved-ac/ui-react/dist/index.css'
2+
import React from 'react'
3+
4+
const App = () => {
5+
return <>Nothing here!</>
6+
}
7+
8+
export default App

example/src/index.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
5+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
6+
sans-serif;
7+
-webkit-font-smoothing: antialiased;
8+
-moz-osx-font-smoothing: grayscale;
9+
}
10+
11+
code {
12+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
13+
monospace;
14+
}

example/src/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
import App from './App'
4+
import './index.css'
5+
6+
7+
ReactDOM.render(<App />, document.getElementById('root'))

example/src/react-app-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="react-scripts" />

example/src/setupTests.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// jest-dom adds custom jest matchers for asserting on DOM nodes.
2+
// allows you to do things like:
3+
// expect(element).toHaveTextContent(/react/i)
4+
// learn more: https://github.com/testing-library/jest-dom
5+
import '@testing-library/jest-dom/extend-expect';
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { Button } from '@solved-ac/ui-react'
2+
import { ComponentMeta, ComponentStory } from '@storybook/react'
3+
import React from 'react'
4+
5+
export default {
6+
title: 'Button',
7+
component: Button,
8+
argTypes: {
9+
children: {
10+
control: 'text',
11+
description: 'The text to display inside the button',
12+
},
13+
backgroundColor: {
14+
control: 'color',
15+
description: 'The background color of the button',
16+
},
17+
hoverColor: {
18+
control: 'color',
19+
description: 'The background color of the button when hovered',
20+
},
21+
primary: {
22+
control: 'boolean',
23+
description: 'Whether the button should be styled as a primary button',
24+
},
25+
fullWidth: {
26+
control: 'boolean',
27+
description:
28+
'Whether the button should take up the full width of its container',
29+
},
30+
circle: {
31+
control: 'boolean',
32+
description: 'Whether the button should be circular',
33+
},
34+
padding: {
35+
control: { type: 'select', options: ['none', 'normal'] },
36+
description: 'The padding of the button',
37+
},
38+
},
39+
} as ComponentMeta<typeof Button>
40+
41+
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
42+
43+
export const Default = Template.bind({})
44+
Default.args = {
45+
children: 'Button',
46+
}
47+
48+
export const Primary = Template.bind({})
49+
Primary.args = {
50+
primary: true,
51+
children: 'Button',
52+
}
53+
54+
export const FullWidth = Template.bind({})
55+
FullWidth.args = {
56+
fullWidth: true,
57+
children: 'Button',
58+
}
59+
60+
export const Circle = Template.bind({})
61+
Circle.args = {
62+
circle: true,
63+
children: 'Button',
64+
}

0 commit comments

Comments
 (0)