Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
BigNumber,
Icon,
Text,
} from "@mittwald/flow-react-components";
import { IconArrowUpRight } from "@tabler/icons-react";

<BigNumber>
<Text>1.284</Text>
<Icon color="success" aria-label="Gestiegen">
<IconArrowUpRight />
</Icon>
<Text>Besucher</Text>
</BigNumber>;
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ description: Die BigNumber stellt Kennzahlen und Metriken prominent dar.

---

# Mit Icon

Vor oder hinter der Zahl kann ein [Icon](/components/content/icon) stehen, z. B.
um einen Trend anzuzeigen. Trägt das Icon eine Bedeutung, gib ihm ein
`aria-label`.

<LiveCodeEditor example="icon" editorCollapsed />

---

# Kombiniere mit ...

## Rating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ChartTooltip,
DonutChart,
Heading,
IconPlus,
Section,
Text,
XAxis,
Expand Down Expand Up @@ -35,6 +36,11 @@ export const DataVisualisationDemo = defineComponent({
<Text>98%</Text>
<Text>Shield strength</Text>
</BigNumber>
<BigNumber>
<IconPlus />
<Text>12</Text>
<Text>Starships</Text>
</BigNumber>
</Section>

<Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ChartTooltip,
DonutChart,
Heading,
IconPlus,
Section,
Text,
XAxis,
Expand All @@ -32,6 +33,11 @@ export default function Page() {
<Text>98%</Text>
<Text>Shield strength</Text>
</BigNumber>
<BigNumber>
<IconPlus />
<Text>12</Text>
<Text>Starships</Text>
</BigNumber>
</Section>

<Section>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
.bigNumber {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
align-items: center;
text-align: center;
row-gap: var(--big-number--spacing);
column-gap: var(--big-number--spacing);
font-size: var(--big-number--top-font-size);
font-weight: var(--big-number--font-weight);

.text {
text-align: center;
}

&:not(:first-child) {
font-size: var(--big-number--bottom-font-size);
}
/* Icons sit in the row of the number; the label below takes its own row. */
.text ~ .text {
flex-basis: 100%;
font-size: var(--big-number--bottom-font-size);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { Meta, StoryObj } from "@storybook/react";
import { BigNumber } from "@/components/BigNumber";
import { Text } from "@/components/Text";
import { Icon } from "@/components/Icon";
import { IconPlus } from "@/components/Icon/components/icons";
import { IconArrowDownRight } from "@tabler/icons-react";

const meta: Meta<typeof BigNumber> = {
title: "Data Visualisation/BigNumber",
Expand All @@ -24,3 +27,25 @@ export const WithSubtitle: Story = {
</BigNumber>
),
};

export const WithIcon: Story = {
render: (props) => (
<BigNumber {...props}>
<IconPlus />
<Text>69%</Text>
<Text>Shield integrity</Text>
</BigNumber>
),
};

export const WithIconAfter: Story = {
render: (props) => (
<BigNumber {...props}>
<Text>12</Text>
<Icon color="danger" aria-label="Decreased">
<IconArrowDownRight />
</Icon>
<Text>Open incidents</Text>
</BigNumber>
),
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { testEnvironments } from "@/tests/lib/environments";
import { alphaColorAccentBoxBackground } from "@/tests/lib/alphaColorAccentBoxBackground";
import { test } from "vitest";
import { IconArrowDownRight } from "@tabler/icons-react";

const staticColors = ["light-static", "dark-static"] as const;

Expand All @@ -9,7 +10,7 @@ test.each(testEnvironments)(
async ({
testScreenshot,
render,
components: { AccentBox, BigNumber, ColumnLayout, Text },
components: { AccentBox, BigNumber, ColumnLayout, Icon, IconPlus, Text },
}) => {
await render(
<ColumnLayout l={[1, 1, 1]} m={[1, 1, 1]} s={[1, 1, 1]} columnGap="xl">
Expand All @@ -30,6 +31,18 @@ test.each(testEnvironments)(
</BigNumber>
</AccentBox>
))}
<BigNumber>
<IconPlus />
<Text>65%</Text>
<Text>Icon before</Text>
</BigNumber>
<BigNumber>
<Text>65%</Text>
<Icon color="danger" aria-label="Decreased">
<IconArrowDownRight />
</Icon>
<Text>Icon after</Text>
</BigNumber>
</ColumnLayout>,
);

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.