Skip to content

Commit

Permalink
Merge branch 'main' into fix/fix-pagination-total-pages-calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
maeshchenko authored Jan 9, 2024
2 parents 296fff4 + f4a7dc5 commit 3531a64
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 64 deletions.
6 changes: 3 additions & 3 deletions src/components/Disclosure/Disclosure.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ $block: '.#{variables.$ns-new}disclosure';
$gap: 8px;

#{$block} {
&_size_m {
&_size_m &__trigger {
@include mixins.text-body-1();
}
&_size_l {
&_size_l &__trigger {
@include mixins.text-body-2();
}
&_size_xl {
&_size_xl &__trigger {
@include mixins.text-subheader-3();
}
&__trigger {
Expand Down
104 changes: 43 additions & 61 deletions src/components/Table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,33 +95,25 @@ import {Table, withTableActions} from '@gravity-ui/uikit';

const MyTable = withTableActions(Table);
const data = [
{id: 1, text: 'Hello'},
{id: 2, text: 'World'},
];
const columns = [
{id: 'id'},
{id: 'text'},
{id: 1, text: 'Hello'},
{id: 2, text: 'World'},
];
const columns = [{id: 'id'}, {id: 'text'}];
const getRowActions = () => {
return [
{
text: 'Print', handler: () => {
}
},
{
text: 'Remove', handler: () => {
}, theme: 'danger'
},
];
}
return [
{
text: 'Print',
handler: () => {},
},
{
text: 'Remove',
handler: () => {},
theme: 'danger',
},
];
};

const table = (
<MyTable
data={data}
columns{columns}
getRowActions={getRowActions}
/>
);
const table = <MyTable data={data} columns={columns} getRowActions={getRowActions} />;
```

## Usage with HOC `withTableCopy`
Expand All @@ -141,20 +133,15 @@ import {Table, withTableCopy} from '@gravity-ui/uikit';

const MyTable = withTableCopy(Table);
const data = [
{id: 1, text: 'Hello'},
{id: 2, text: 'World'},
{id: 1, text: 'Hello'},
{id: 2, text: 'World'},
];
const columns = [
{id: 'id', meta: {copy: ({id}) => `ID #${id}`}},
{id: 'text', meta: {copy: true}},
{id: 'id', meta: {copy: ({id}) => `ID #${id}`}},
{id: 'text', meta: {copy: true}},
];

const table = (
<MyTable
data={data}
columns{columns}
/>
);
const table = <MyTable data={data} columns={columns} />;
```

## Usage with HOC `withTableSelection`
Expand All @@ -175,27 +162,24 @@ import {Table, withTableSelection} from '@gravity-ui/uikit';

const MyTable = withTableSelection(Table);
const data = [
{id: 1, text: 'Hello'},
{id: 2, text: 'World'},
];
const columns = [
{id: 'id'},
{id: 'text'},
{id: 1, text: 'Hello'},
{id: 2, text: 'World'},
];
const columns = [{id: 'id'}, {id: 'text'}];
const getRowId = 'id';

function SelectionTable() {
const [selectedIds, setSelectedIds] = React.useState([1]);

return (
<MyTable
data={data}
columns{columns}
getRowId={getRowId}
selectedIds={selectedIds}
onSelectionChange={setSelectedIds}
/>
);
const [selectedIds, setSelectedIds] = React.useState([1]);

return (
<MyTable
data={data}
columns={columns}
getRowId={getRowId}
selectedIds={selectedIds}
onSelectionChange={setSelectedIds}
/>
);
}
```

Expand Down Expand Up @@ -313,18 +297,16 @@ import {Table, withTableSorting} from '@gravity-ui/uikit';

const MyTable = withTableSorting(Table);
const data = [
{id: 1, text: 'Hello', date: '2016-10-25'},
{id: 2, text: 'World', date: '2020-08-15'},
{id: 1, text: 'Hello', date: '2016-10-25'},
{id: 2, text: 'World', date: '2020-08-15'},
];
const columns = [
{id: 'id', meta: {sort: true}},
{id: 'text', meta: {defaultSortOrder: 'desc', sort: (a, b) => Date.parse(a.date) - Date.parse(b.date)}},
{id: 'id', meta: {sort: true}},
{
id: 'text',
meta: {defaultSortOrder: 'desc', sort: (a, b) => Date.parse(a.date) - Date.parse(b.date)},
},
];

const table = (
<MyTable
data={data}
columns{columns}
/>
);
const table = <MyTable data={data} columns={columns} />;
```

0 comments on commit 3531a64

Please sign in to comment.