-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into mh/log_scale
- Loading branch information
Showing
19 changed files
with
224 additions
and
122 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
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
2 changes: 1 addition & 1 deletion
2
src/vis/bar/interfaces/internal/helpers/get-data-for-aggregate-type.test.ts
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
38 changes: 0 additions & 38 deletions
38
src/vis/bar/interfaces/internal/helpers/get-truncated-text-map.ts
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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,86 @@ | ||
import React from 'react'; | ||
import { ComponentStory } from '@storybook/react'; | ||
import { Stack, Text, Group } from '@mantine/core'; | ||
import { ESortStates, SortIcon, ISortIconProps } from './SortIcon'; | ||
|
||
function Wrapper({ props, initialState }: { props?: Omit<ISortIconProps, 'sortState' | 'setSortState'>; initialState?: ESortStates }) { | ||
const [sortState, setSortState] = React.useState<ESortStates>(initialState || ESortStates.NONE); | ||
|
||
return ( | ||
<Stack gap="xs"> | ||
<Group> | ||
<SortIcon {...props} sortState={sortState} setSortState={setSortState} /> | ||
|
||
{[2, 1, 5, 3, 4] | ||
.sort((a, b) => { | ||
switch (sortState) { | ||
case ESortStates.ASC: | ||
return a - b; | ||
case ESortStates.DESC: | ||
return b - a; | ||
default: | ||
return 0; | ||
} | ||
}) | ||
.map((i) => ( | ||
<Text key={i}>{i}</Text> | ||
))} | ||
</Group> | ||
</Stack> | ||
); | ||
} | ||
|
||
function Docs() { | ||
return ( | ||
<Stack p="xl" gap="xl"> | ||
<Stack gap="xs"> | ||
<Text fz="xl" fw={500}> | ||
Basic example | ||
</Text> | ||
<Wrapper /> | ||
</Stack> | ||
<Stack gap="xs"> | ||
<Text fz="xl" fw={500}> | ||
Compact icon | ||
</Text> | ||
<Wrapper props={{ compact: true }} /> | ||
</Stack> | ||
<Stack gap="xs"> | ||
<Text fz="xl" fw={500}> | ||
With priority | ||
</Text> | ||
<Wrapper props={{ priority: 1 }} /> | ||
</Stack> | ||
<Stack gap="xs"> | ||
<Text fz="xl" fw={500}> | ||
Has no unsorted state | ||
</Text> | ||
<Wrapper props={{ hasUnsortedState: false }} initialState={ESortStates.ASC} /> | ||
</Stack> | ||
<Stack gap="xs"> | ||
<Stack gap={0}> | ||
<Text fz="xl" fw={500}> | ||
Sort descending on first click | ||
</Text> | ||
<Text c="dimmed">Only for specific use cases - the default is ascending</Text> | ||
</Stack> | ||
<Wrapper props={{ sortStateOnFirstClick: ESortStates.DESC }} /> | ||
</Stack> | ||
</Stack> | ||
); | ||
} | ||
|
||
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
export default { | ||
title: 'Components/SortIcon', | ||
component: Docs, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
}; | ||
|
||
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
// eslint-disable-next-line react/function-component-definition | ||
const Template: ComponentStory<typeof Docs> = (args) => { | ||
return <Docs />; | ||
}; | ||
|
||
export const Default: typeof Template = Template.bind({}); |
Oops, something went wrong.