-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Oppdaterer dokumentasjonen til stat * Legger til changeset
- Loading branch information
1 parent
b4eae99
commit 27880d6
Showing
3 changed files
with
75 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@kvib/react": minor | ||
--- | ||
|
||
Oppdaterer dokumentasjon for Stat. |
13 changes: 11 additions & 2 deletions
13
apps/storybook/stories/components/data-display/stat/Stat.mdx
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 |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import { Meta } from "@storybook/blocks"; | ||
import { Meta, Canvas, Story, Controls } from "@storybook/blocks"; | ||
import * as StatStories from "./Stat.stories"; | ||
|
||
<Meta title="Komponenter/Data Display/Stat" /> | ||
|
||
# Stat | ||
|
||
Se [https://chakra-ui.com/docs/components/stat](https://chakra-ui.com/docs/components/stat) for eksempler og dokumentasjon. | ||
Stat-komponentet brukes til å vise frem statistikk. | ||
|
||
## Ta i bruk | ||
|
||
```jsx | ||
import { Stat, StatLabel, StatNumber, StatHelpText, StatArrow, StatGroup } from "@kvib/react"; | ||
``` | ||
|
||
## Props | ||
|
||
<Canvas of={StatStories.Stat} /> | ||
|
||
## Stat med indikator | ||
|
||
<Canvas of={StatStories.StatIndicator} /> |
59 changes: 59 additions & 0 deletions
59
apps/storybook/stories/components/data-display/stat/Stat.stories.tsx
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,59 @@ | ||
import { | ||
Stat as KvibStat, | ||
StatLabel as KvibStatLabel, | ||
StatNumber as KvibStatNumber, | ||
StatHelpText as KvibStatHelpText, | ||
StatArrow as KvibStatArrow, | ||
StatGroup as KvibStatGroup, | ||
} from "@kvib/react/src"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
const meta: Meta<typeof KvibStat> = { | ||
title: "Komponenter/Data Display/Stat", | ||
component: KvibStat, | ||
parameters: { | ||
docs: { | ||
story: { inline: true }, | ||
canvas: { sourceState: "shown" }, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof KvibStat>; | ||
|
||
export const Stat: Story = { | ||
args: {}, | ||
render: (args) => ( | ||
<KvibStat {...args}> | ||
<KvibStatLabel>Utgifter</KvibStatLabel> | ||
<KvibStatNumber>3200kr</KvibStatNumber> | ||
<KvibStatHelpText>Feb 12 - Feb 28</KvibStatHelpText> | ||
</KvibStat> | ||
), | ||
}; | ||
|
||
export const StatIndicator: Story = { | ||
args: {}, | ||
render: (args) => ( | ||
<KvibStatGroup> | ||
<KvibStat {...args}> | ||
<KvibStatLabel>Sendt</KvibStatLabel> | ||
<KvibStatNumber>345,670</KvibStatNumber> | ||
<KvibStatHelpText> | ||
<KvibStatArrow type="increase" /> | ||
23.36% | ||
</KvibStatHelpText> | ||
</KvibStat> | ||
|
||
<KvibStat {...args}> | ||
<KvibStatLabel>Klikk</KvibStatLabel> | ||
<KvibStatNumber>45</KvibStatNumber> | ||
<KvibStatHelpText> | ||
<KvibStatArrow type="decrease" /> | ||
9.05% | ||
</KvibStatHelpText> | ||
</KvibStat> | ||
</KvibStatGroup> | ||
), | ||
}; |