Skip to content

Commit

Permalink
Komp-186-stat (#348)
Browse files Browse the repository at this point in the history
* Oppdaterer dokumentasjonen til stat

* Legger til changeset
  • Loading branch information
adrianflatner authored Aug 1, 2023
1 parent b4eae99 commit 27880d6
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-apes-sparkle.md
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 apps/storybook/stories/components/data-display/stat/Stat.mdx
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} />
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>
),
};

0 comments on commit 27880d6

Please sign in to comment.