Skip to content

Commit 61e6915

Browse files
authored
Merge pull request #70 from jbetancur/enhancement-themeing-3
theme changes
2 parents 5daa991 + 0c774a2 commit 61e6915

10 files changed

Lines changed: 117 additions & 62 deletions

File tree

README.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,7 @@ class MyComponent extends Component {
355355
```
356356
357357
## Theming
358-
Under Development
359-
360-
The curent default Theme is very "material". Near term plans are to have 3 built-in prop selectable themes (none, bootstrap, material).
361-
362-
You can override or replace the current theme using the `customTheme` prop
358+
You can override or replace the default theme using the `customTheme` prop. Internally, this just deep merges your theme with the default theme.
363359
364360
For Example:
365361
@@ -384,21 +380,18 @@ class MyComponent extends Component {
384380
);
385381
```
386382
387-
Refer to [Default Theme](https://github.com/jbetancur/react-data-table-component/blob/master/src/themes/default.js) for reference
383+
Refer to [Default Theme](https://github.com/jbetancur/react-data-table-component/blob/master/src/themes/default.js) for reference and avaiilable properties to override
388384
389385
390386
### Theme Resources
391387
* [SVG Encoder](https://codepen.io/yoksel/details/JDqvs)
392388
393-
394389
# Development
395390
396391
## Setup
397-
398392
Install the latest [Node JS LTS](https://nodejs.org/) and [Yarn](https://yarnpkg.com) and simply run ```yarn``` or ```yarn install``` command in the root and stories directory.
399393
400394
## Installing Flow Types
401-
402395
Install flowtypes using the package script:
403396
```sh
404397
yarn flow-typed
@@ -407,7 +400,6 @@ yarn flow-typed
407400
> It is advised to run the script whenever NPM packages are installed.
408401
409402
## Local development
410-
411403
During development,
412404
```sh
413405
# watch and build new source changes
@@ -417,7 +409,6 @@ yarn storybook
417409
```
418410
419411
## Including NPM packages
420-
421412
This project uses two package.json structure.
422413
423414
### Library dependencies -- <root_dir>/package.json
@@ -435,13 +426,11 @@ yarn add [package-name]
435426
```
436427
437428
## Static Types
438-
439429
```sh
440430
yarn flow # performs type checking on files
441431
```
442432
443433
## Lint
444-
445434
```sh
446435
yarn lint # runs linter to detect any style issues (css & js)
447436
yarn lint:css # lint only css
@@ -450,14 +439,12 @@ yarn lint:js --fix # tries to fix js lint issues
450439
```
451440
452441
## Test
453-
454442
```sh
455443
yarn test # runs functional/unit tests using Jest
456444
yarn test --coverage # with coverage
457445
```
458446
459447
## Build
460-
461448
```sh
462449
yarn build # builds sources at src/
463450
```

src/DataTable/ContextMenu.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import styled from 'styled-components';
33
import { DataTableConsumer } from './DataTableContext';
44

55
const Title = styled.div`
6-
color: ${props => props.theme.header.contextMenu.fontColor};
7-
font-size: ${props => props.theme.header.contextMenu.fontSize};
6+
color: ${props => props.theme.contextMenu.fontColor};
7+
font-size: ${props => props.theme.contextMenu.fontSize};
88
font-weight: 400;
99
`;
1010

@@ -14,10 +14,10 @@ const ContextMenuStyle = styled.div`
1414
left: 0;
1515
width: 100%;
1616
height: 100%;
17-
background-color: ${props => props.theme.header.contextMenu.backgroundColor};
17+
background-color: ${props => props.theme.contextMenu.backgroundColor};
1818
z-index: 1;
1919
transform: ${props => (props.visible ? 'translate3d(0, 0, 0)' : 'translate3d(0, -100%, 0)')};
20-
transition-duration: ${props => props.theme.header.contextMenu.transitionTime};
20+
transition-duration: ${props => props.theme.contextMenu.transitionTime};
2121
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
2222
transition-delay: 0;
2323
will-change: transform;

src/DataTable/ExpanderRow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const renderChildren = (children, data) => {
1111
const ExpanderRowStyle = styled.div`
1212
width: 100%;
1313
box-sizing: border-box;
14+
color: ${props => props.theme.expander.fontColor};
1415
background-color: ${props => props.theme.expander.backgroundColor};
1516
`;
1617

src/DataTable/TableRow.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ import TableCellExpander from './TableCellExpander';
88
import ExpanderRow from './ExpanderRow';
99

1010
const defaultRowsCSS = css`
11-
border-top: ${props => props.theme.rows.borderWidth} solid ${props => props.theme.rows.borderColor};
11+
border-top-style: solid;
12+
border-top-width: ${props => props.theme.rows.borderWidth};
13+
border-top-color: ${props => props.theme.rows.borderColor};
1214
`;
1315

1416
const spacedRowsCSS = css`
1517
margin-top: ${props => props.theme.rows.spacingMargin || 0};
1618
margin-bottom: ${props => props.theme.rows.spacingMargin || 0};
1719
border-radius: ${props => props.theme.rows.spacingBorderRadius || 0};
18-
border: ${props => props.theme.rows.borderWidth} solid ${props => props.theme.rows.borderColor};
20+
border-style: solid;
21+
border-width: ${props => props.theme.rows.borderWidth};
22+
border-color: ${props => props.theme.rows.borderColor};
1923
${props => props.theme.rows.spacingShadow && `box-shadow: ${props.theme.rows.spacingShadow}`};
2024
`;
2125

@@ -28,7 +32,7 @@ const stripedCSS = css`
2832
const hightlightCSS = css`
2933
&:hover {
3034
color: ${props => props.theme.rows.hoverFontColor};
31-
background-color: ${props => props.theme.rows.hoverColor};
35+
background-color: ${props => props.theme.rows.hoverBackgroundColor};
3236
transition-duration: 0.15s;
3337
transition-property: background-color;
3438
}

src/DataTable/__tests__/__snapshots__/DataTable.test.js.snap

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ exports[`Pagination should render correctly if pagination is enabled 1`] = `
130130
display: -ms-flexbox;
131131
display: flex;
132132
width: 100%;
133-
border-top: 1px solid rgba(0,0,0,.12);
133+
border-top-style: solid;
134+
border-top-width: 1px;
135+
border-top-color: rgba(0,0,0,.12);
134136
background-color: transparent;
135137
color: rgba(0,0,0,.87);
136138
}
@@ -843,7 +845,9 @@ exports[`expandableRows should render correctly when expandableRows is true 1`]
843845
display: -ms-flexbox;
844846
display: flex;
845847
width: 100%;
846-
border-top: 1px solid rgba(0,0,0,.12);
848+
border-top-style: solid;
849+
border-top-width: 1px;
850+
border-top-color: rgba(0,0,0,.12);
847851
background-color: transparent;
848852
color: rgba(0,0,0,.87);
849853
}
@@ -1267,6 +1271,7 @@ exports[`expandableRows should render correctly when expandableRows is true and
12671271
.c18 {
12681272
width: 100%;
12691273
box-sizing: border-box;
1274+
color: rgba(0,0,0,.87);
12701275
background-color: transparent;
12711276
}
12721277
@@ -1276,7 +1281,9 @@ exports[`expandableRows should render correctly when expandableRows is true and
12761281
display: -ms-flexbox;
12771282
display: flex;
12781283
width: 100%;
1279-
border-top: 1px solid rgba(0,0,0,.12);
1284+
border-top-style: solid;
1285+
border-top-width: 1px;
1286+
border-top-color: rgba(0,0,0,.12);
12801287
background-color: transparent;
12811288
color: rgba(0,0,0,.87);
12821289
}
@@ -1813,7 +1820,9 @@ exports[`progress/nodata should render correctly when progressPending is true 1`
18131820
display: -ms-flexbox;
18141821
display: flex;
18151822
width: 100%;
1816-
border-top: 1px solid rgba(0,0,0,.12);
1823+
border-top-style: solid;
1824+
border-top-width: 1px;
1825+
border-top-color: rgba(0,0,0,.12);
18171826
background-color: transparent;
18181827
color: rgba(0,0,0,.87);
18191828
}
@@ -2189,7 +2198,9 @@ exports[`prop changes should update state if the data prop changes 1`] = `
21892198
display: -ms-flexbox;
21902199
display: flex;
21912200
width: 100%;
2192-
border-top: 1px solid rgba(0,0,0,.12);
2201+
border-top-style: solid;
2202+
border-top-width: 1px;
2203+
border-top-color: rgba(0,0,0,.12);
21932204
background-color: transparent;
21942205
color: rgba(0,0,0,.87);
21952206
}
@@ -2546,7 +2557,9 @@ exports[`selectableRows should render correctly when selectableRows is true 1`]
25462557
display: -ms-flexbox;
25472558
display: flex;
25482559
width: 100%;
2549-
border-top: 1px solid rgba(0,0,0,.12);
2560+
border-top-style: solid;
2561+
border-top-width: 1px;
2562+
border-top-color: rgba(0,0,0,.12);
25502563
background-color: transparent;
25512564
color: rgba(0,0,0,.87);
25522565
}
@@ -2978,7 +2991,9 @@ exports[`selectableRows should render correctly when selectableRows is true and
29782991
display: -ms-flexbox;
29792992
display: flex;
29802993
width: 100%;
2981-
border-top: 1px solid rgba(0,0,0,.12);
2994+
border-top-style: solid;
2995+
border-top-width: 1px;
2996+
border-top-color: rgba(0,0,0,.12);
29822997
background-color: transparent;
29832998
color: rgba(0,0,0,.87);
29842999
}
@@ -3410,7 +3425,9 @@ exports[`selectableRows should render correctly when selectableRows is true and
34103425
display: -ms-flexbox;
34113426
display: flex;
34123427
width: 100%;
3413-
border-top: 1px solid rgba(0,0,0,.12);
3428+
border-top-style: solid;
3429+
border-top-width: 1px;
3430+
border-top-color: rgba(0,0,0,.12);
34143431
background-color: transparent;
34153432
color: rgba(0,0,0,.87);
34163433
}
@@ -3844,7 +3861,9 @@ exports[`selectableRows should render correctly when selectableRows is true and
38443861
display: -ms-flexbox;
38453862
display: flex;
38463863
width: 100%;
3847-
border-top: 1px solid rgba(0,0,0,.12);
3864+
border-top-style: solid;
3865+
border-top-width: 1px;
3866+
border-top-color: rgba(0,0,0,.12);
38483867
background-color: transparent;
38493868
color: rgba(0,0,0,.87);
38503869
}
@@ -4417,7 +4436,9 @@ exports[`should render correctly if the keyField is overriden 1`] = `
44174436
display: -ms-flexbox;
44184437
display: flex;
44194438
width: 100%;
4420-
border-top: 1px solid rgba(0,0,0,.12);
4439+
border-top-style: solid;
4440+
border-top-width: 1px;
4441+
border-top-color: rgba(0,0,0,.12);
44214442
background-color: transparent;
44224443
color: rgba(0,0,0,.87);
44234444
}
@@ -4754,7 +4775,9 @@ exports[`should render correctly with columns/data 1`] = `
47544775
display: -ms-flexbox;
47554776
display: flex;
47564777
width: 100%;
4757-
border-top: 1px solid rgba(0,0,0,.12);
4778+
border-top-style: solid;
4779+
border-top-width: 1px;
4780+
border-top-color: rgba(0,0,0,.12);
47584781
background-color: transparent;
47594782
color: rgba(0,0,0,.87);
47604783
}
@@ -5108,7 +5131,9 @@ exports[`should render without a header if noHeader is true 1`] = `
51085131
display: -ms-flexbox;
51095132
display: flex;
51105133
width: 100%;
5111-
border-top: 1px solid rgba(0,0,0,.12);
5134+
border-top-style: solid;
5135+
border-top-width: 1px;
5136+
border-top-color: rgba(0,0,0,.12);
51125137
background-color: transparent;
51135138
color: rgba(0,0,0,.87);
51145139
}
@@ -5392,7 +5417,9 @@ exports[`sorting should render correctly when a column is sorted 1`] = `
53925417
display: -ms-flexbox;
53935418
display: flex;
53945419
width: 100%;
5395-
border-top: 1px solid rgba(0,0,0,.12);
5420+
border-top-style: solid;
5421+
border-top-width: 1px;
5422+
border-top-color: rgba(0,0,0,.12);
53965423
background-color: transparent;
53975424
color: rgba(0,0,0,.87);
53985425
}
@@ -5761,7 +5788,9 @@ exports[`sorting should render correctly with a default sort field 1`] = `
57615788
display: -ms-flexbox;
57625789
display: flex;
57635790
width: 100%;
5764-
border-top: 1px solid rgba(0,0,0,.12);
5791+
border-top-style: solid;
5792+
border-top-width: 1px;
5793+
border-top-color: rgba(0,0,0,.12);
57655794
background-color: transparent;
57665795
color: rgba(0,0,0,.87);
57675796
}

src/DataTable/__tests__/__snapshots__/ExpanderRow.test.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ exports[`<ExpanderRow /> should render correctly 1`] = `
44
.c0 {
55
width: 100%;
66
box-sizing: border-box;
7+
color: rgba(0,0,0,.87);
78
background-color: transparent;
89
}
910
@@ -16,6 +17,7 @@ exports[`<ExpanderRow /> with children should render correctly and have a data p
1617
.c0 {
1718
width: 100%;
1819
box-sizing: border-box;
20+
color: rgba(0,0,0,.87);
1921
background-color: transparent;
2022
}
2123
@@ -34,6 +36,7 @@ exports[`<ExpanderRow numColumns /> should render correctly 1`] = `
3436
.c0 {
3537
width: 100%;
3638
box-sizing: border-box;
39+
color: rgba(0,0,0,.87);
3740
background-color: transparent;
3841
}
3942

0 commit comments

Comments
 (0)