Skip to content

Commit 0bc038a

Browse files
authored
Release/0.1.0 (#25)
* Added page and panel * Added (in))valid colors * Added base cards * Added card variants * Added grid system * Added icons * Added form message * Added tags * Added overlays * Added tooltips * Added modals
1 parent 9fd5f08 commit 0bc038a

File tree

162 files changed

+52462
-83
lines changed

Some content is hidden

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

162 files changed

+52462
-83
lines changed

.eslintrc

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"plugins": ["@typescript-eslint/eslint-plugin"],
4+
"extends": [
5+
"eslint:recommended",
6+
"plugin:@typescript-eslint/recommended",
7+
"plugin:react/recommended"
8+
],
9+
"parserOptions": {
10+
"ecmaVersion": 6,
11+
"sourceType": "module",
12+
"project": "./tsconfig.json"
13+
},
14+
"env": {
15+
"node": true,
16+
"es6": true
17+
},
18+
"ignorePatterns": ["dist", "setupTests.ts", "babel.config.js"],
19+
"rules": {
20+
"comma-dangle": "off",
21+
"class-methods-use-this": "off",
22+
"import/prefer-default-export": "off",
23+
"import/no-dynamic-require": "off",
24+
"global-require": "off",
25+
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
26+
"@typescript-eslint/indent": ["error", 4],
27+
"@typescript-eslint/ban-ts-comment": "off"
28+
}
29+
}

.github/workflows/ci.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI
4+
5+
on: [push, pull_request]
6+
jobs:
7+
test-coverage:
8+
name: Test on Node.js Latest
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
- name: Use Node.js latest
14+
uses: actions/[email protected]
15+
with:
16+
node-version: "15"
17+
- name: Install dependencies
18+
run: npm install
19+
- name: Generate coverage report
20+
run: npm run test-coverage
21+
- name: Upload coverage report
22+
uses: codecov/[email protected]
23+
with:
24+
token: ${{ secrets.CODECOV }}
25+
test-node-12:
26+
name: Test on Node.js v12
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout codd
30+
uses: actions/checkout@v2
31+
- name: Use Node.js v12
32+
uses: actions/[email protected]
33+
with:
34+
node-version: "12"

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
/dist
14+
15+
# misc
16+
.DS_Store
17+
.env.local
18+
.env.development.local
19+
.env.test.local
20+
.env.production.local
21+
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*
25+
26+
# IDE
27+
/.idea

.idea/vcs.xml

-6
This file was deleted.

.idea/workspace.xml

-68
This file was deleted.

.travis.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: node_js
2+
3+
node_js:
4+
- "12"
5+
6+
script:
7+
- npm install codecov -g
8+
- npm run build
9+
after_success:
10+
- bash <(curl -s https://codecov.io/bash)
11+
- codecov -f coverage/*.json

__tests__/.gitkeep

Whitespace-only changes.

__tests__/Button.test.tsx

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { shallow } from 'enzyme';
2+
import React from 'react';
3+
import { Button } from '@/components/Button';
4+
import { Variant } from '@/components';
5+
6+
describe('Button test', () => {
7+
it('should render button', () => {
8+
const container = shallow(
9+
<Button
10+
variant={Variant.PRIMARY}
11+
>
12+
Hello world
13+
</Button>
14+
);
15+
16+
expect(container.find('button').length).toBe(1);
17+
});
18+
19+
it('should render button as link', () => {
20+
const container = shallow(
21+
<Button
22+
as="a"
23+
variant={Variant.PRIMARY}
24+
>
25+
Hello world
26+
</Button>
27+
);
28+
29+
expect(container.find('a').length).toBe(1);
30+
});
31+
32+
it('should render block button', () => {
33+
const container = shallow(
34+
<Button
35+
variant={Variant.PRIMARY}
36+
block
37+
>
38+
Hello world
39+
</Button>
40+
);
41+
42+
expect(container.find('button').hasClass('btn-block')).toBeTruthy();
43+
});
44+
45+
it('should render small button', () => {
46+
const container = shallow(
47+
<Button
48+
variant={Variant.PRIMARY}
49+
small
50+
>
51+
Hello world
52+
</Button>
53+
);
54+
55+
expect(container.find('button').hasClass('btn-small')).toBeTruthy();
56+
});
57+
58+
it('should render button with icon left', () => {
59+
const container = shallow(
60+
<Button
61+
variant={Variant.PRIMARY}
62+
iconLeft={<i>icon</i>}
63+
>
64+
Hello world
65+
</Button>
66+
);
67+
68+
expect(container.find('button').find('i').text()).toContain('icon');
69+
});
70+
71+
it('should render button with icon left', () => {
72+
const container = shallow(
73+
<Button
74+
variant={Variant.PRIMARY}
75+
iconRight={<i>icon</i>}
76+
>
77+
Hello world
78+
</Button>
79+
);
80+
81+
expect(container.find('button').find('i').text()).toContain('icon');
82+
});
83+
});

__tests__/Card.test.tsx

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { render } from 'enzyme';
2+
import React from 'react';
3+
import Card from '@/components/Card/Card';
4+
import CardContent from '@/components/Card/Content';
5+
import CardHeader from '@/components/Card/Header';
6+
import { Variant } from '@/components';
7+
8+
describe('Card test', () => {
9+
it('should render card', () => {
10+
const container = render(
11+
<div>
12+
<Card />
13+
</div>
14+
);
15+
16+
expect(container.find('.card').length).toBe(1);
17+
});
18+
19+
it('should render card header', () => {
20+
const container = render(
21+
<div>
22+
<Card>
23+
<Card.Header title="Foo" />
24+
<CardHeader title="Foo" />
25+
Hello world
26+
</Card>
27+
</div>
28+
);
29+
30+
expect(container.find('.card .card-header').length).toBe(2);
31+
});
32+
33+
it('should render card header with actions', () => {
34+
const container = render(
35+
<div>
36+
<Card>
37+
<Card.Header title="Foo" actions={[<div key="1" className="foo"/>, null]} />
38+
Hello world
39+
</Card>
40+
</div>
41+
);
42+
43+
expect(container.find('.card .card-header .card-header-action').length).toBe(1);
44+
});
45+
46+
it('should render card content', () => {
47+
const container = render(
48+
<div>
49+
<Card>
50+
<Card.Content>Content</Card.Content>
51+
<CardContent>Content</CardContent>
52+
</Card>
53+
</div>
54+
);
55+
56+
expect(container.find('.card .card-content').text()).toBe('ContentContent');
57+
});
58+
59+
it('should render variant card ', () => {
60+
const container = render(
61+
<div>
62+
<Card variant={Variant.PRIMARY} />
63+
</div>
64+
);
65+
66+
expect(container.find('.card.card-primary').length).toBe(1);
67+
});
68+
});

__tests__/Container.test.tsx

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { render } from 'enzyme';
2+
import React from 'react';
3+
import Container from '@/components/Container/Container';
4+
5+
describe('Container test', () => {
6+
it('should render container', () => {
7+
const container = render(
8+
<div>
9+
<Container/>
10+
</div>
11+
);
12+
13+
expect(container.find('.container').length).toBe(1);
14+
});
15+
16+
it('should render fluid container', () => {
17+
const container = render(
18+
<div>
19+
<Container fluid/>
20+
</div>
21+
);
22+
23+
expect(container.find('.container-fluid').length).toBe(1);
24+
});
25+
});

0 commit comments

Comments
 (0)