-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from komarovalexander/dev
Add ability to change styles using sass variables
- Loading branch information
Showing
14 changed files
with
156 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.custom-theme-demo{ | ||
@import './dark.scss'; | ||
@import '../../lib/style.scss'; | ||
|
||
.ka{ | ||
border-radius: 12px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
import CustomThemeDemo from './CustomThemeDemo'; | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<CustomThemeDemo />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// open TS Example or JS Example to see how to override styles | ||
import './CustomThemeDemo.scss'; | ||
|
||
import React, { useState } from 'react'; | ||
|
||
import { ITableProps, kaReducer, Table } from '../../lib'; | ||
import { DataType, EditingMode, FilteringMode, SortingMode } from '../../lib/enums'; | ||
import { DispatchFunc } from '../../lib/types'; | ||
|
||
const dataArray = Array(119).fill(undefined).map( | ||
(_, index) => ({ | ||
column1: index % 2 === 0, | ||
column2: `column:2 row:${index}`, | ||
column3: index % 5, | ||
column4: new Date(2022, 11, index), | ||
id: index, | ||
}), | ||
); | ||
|
||
const tablePropsInit: ITableProps = { | ||
columns: [ | ||
{ key: 'column1', title: 'Column 1', dataType: DataType.Boolean, style: {minWidth: 130} }, | ||
{ key: 'column2', title: 'Column 2', dataType: DataType.String, style: {width: 240} }, | ||
{ key: 'column3', title: 'Column 3', dataType: DataType.Number, style: {width: 230} }, | ||
{ key: 'column4', title: 'Column 4', dataType: DataType.Date, style: {minWidth: 100} }, | ||
], | ||
format: ({ column, value }) => { | ||
if (column.dataType === DataType.Date){ | ||
return value && value.toLocaleDateString('en', {month: '2-digit', day: '2-digit', year: 'numeric' }); | ||
} | ||
}, | ||
paging: { | ||
enabled: true, | ||
pageSize: 7, | ||
pageIndex: 0 | ||
}, | ||
data: dataArray, | ||
editingMode: EditingMode.Cell, | ||
rowKeyField: 'id', | ||
sortingMode: SortingMode.Single, | ||
filteringMode: FilteringMode.FilterRow | ||
}; | ||
|
||
const CustomThemeDemo: React.FC = () => { | ||
const [tableProps, changeTableProps] = useState(tablePropsInit); | ||
|
||
const dispatch: DispatchFunc = (action) => { | ||
changeTableProps((prevState: ITableProps) => kaReducer(prevState, action)); | ||
}; | ||
|
||
return ( | ||
<div className='custom-theme-demo'> | ||
<Table | ||
{...tableProps} | ||
dispatch={dispatch} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CustomThemeDemo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
$ka-background-color: #2c2c2c; | ||
$ka-border-color: #4d4d4d; | ||
$ka-cell-hover-background-color: transparentize(#fff, 0.8); | ||
$ka-color-base:#fefefe; | ||
$ka-input-background-color: $ka-background-color; | ||
$ka-input-border-color: $ka-border-color; | ||
$ka-input-color: $ka-color-base; | ||
$ka-row-hover-background-color: transparentize(#fff, 0.9); | ||
$ka-thead-background-color: #1b1b1b; | ||
$ka-thead-color: #c5c5c5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
$ka-border-color: #F9FBFC !default; | ||
$ka-color-base: #353C44 !default; | ||
$ka-thead-color: #747D86 !default; | ||
|
||
$ka-background-color: white !default; | ||
$ka-input-background-color: null !default; | ||
$ka-input-border-color: null !default; | ||
$ka-input-color: null !default; | ||
$ka-cell-color: $ka-color-base !default; | ||
$ka-cell-hover-background-color: null !default; | ||
$ka-cell-line-height: 29px !default; | ||
$ka-cell-padding: 8px 20px !default; | ||
$ka-column-resize-border-color: darken($ka-border-color, 10) !default; | ||
$ka-filter-row-cell-padding: 0 20px 15px 20px; | ||
$ka-font-size: 14px !default; | ||
$ka-group-cell-padding: 8px 10px !default; | ||
$ka-group-row-background-color: #F9FBFC !default; | ||
$ka-group-row-border-color: white !default; | ||
$ka-group-row-border-size: 1px !default; | ||
$ka-icon-font-size: 10px !default; | ||
$ka-input-validation-background-color: #FFE7E7 !default; | ||
$ka-loading-backdrop-color: #ffffff88 !default; | ||
$ka-loading-background-color-base: rgb(116,125,134) !default; | ||
$ka-paging-index-active-background-color: #F1F5F7 !default; | ||
$ka-paging-index-active-color: #747D86 !default; | ||
$ka-paging-index-color: $ka-thead-color !default; | ||
$ka-paging-pages-padding: 0 10px; | ||
$ka-row-border-size: 2px !default; | ||
$ka-row-hover-background-color: null !default; | ||
$ka-selected-border-color: darken($ka-border-color, 7) !default; | ||
$ka-selecter-background-color: #F7FcFd !default; | ||
$ka-thead-background-color: #F1F5F7 !default; | ||
$ka-thead-cell-padding: 15px 20px !default; | ||
$ka-validation-background-color: #FF0C0C !default; | ||
$ka-validation-color: white !default; | ||
$ka-validation-message-font-size: 12px !default; | ||
$ka-validation-message-padding: 0 10px !default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters