Skip to content

Commit 3c0b35c

Browse files
author
Sine Jespersen
committed
5398: user info component added
1 parent 5f04223 commit 3c0b35c

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed

base.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
@import "./src/stories/Library/status-label/status-label";
2222
@import "./src/stories/Library/number/number";
2323
@import "./src/stories/Library/counter/counter";
24+
@import "./src/stories/Library/user-info/user-info";
2425
@import "./src/stories/Library/Forms/checkbox/checkbox";
2526
@import "./src/stories/Library/material/material";
2627
@import "./src/stories/Library/progress-bar/progress-bar";
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { ComponentMeta, ComponentStory } from "@storybook/react";
2+
import { withDesign } from "storybook-addon-designs";
3+
import UserInfo from "./UserInfo";
4+
5+
export default {
6+
title: "Library / User info",
7+
component: UserInfo,
8+
decorators: [withDesign],
9+
argTypes: {
10+
address: {
11+
control: "text",
12+
defaultValue:
13+
"The Utonium Residence, 107 Pokey Oaks South, Townsville, USA",
14+
},
15+
nameLabel: {
16+
control: "text",
17+
defaultValue: "Navn",
18+
},
19+
addressLabel: {
20+
control: "text",
21+
defaultValue: "Adresse",
22+
},
23+
name: {
24+
control: "text",
25+
defaultValue: "Professor Utonium",
26+
},
27+
},
28+
parameters: {},
29+
} as ComponentMeta<typeof UserInfo>;
30+
31+
const Template: ComponentStory<typeof UserInfo> = (props) => (
32+
<UserInfo {...props} />
33+
);
34+
35+
export const UserInfoExample = Template.bind({});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export type UserInfoProps = {
2+
name: string;
3+
nameLabel: string;
4+
address: string;
5+
addressLabel: string;
6+
};
7+
8+
const UserInfo = (props: UserInfoProps) => {
9+
const { name, nameLabel, address, addressLabel } = props;
10+
11+
return (
12+
<div className="dpl-user-info">
13+
<div className="dpl-user-info__label">{nameLabel}</div>
14+
<div className="dpl-user-info__text">{name}</div>
15+
<div className="dpl-user-info__label">{addressLabel}</div>
16+
<div className="dpl-user-info__text">{address}</div>
17+
</div>
18+
);
19+
};
20+
21+
export default UserInfo;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.dpl-user-info {
2+
@extend .color-secondary-gray;
3+
@extend .bg-global-secondary;
4+
@extend .pb-32;
5+
6+
&__label {
7+
@extend .text-body-medium-medium;
8+
@extend .ml-32;
9+
@extend .pt-32;
10+
}
11+
&__text {
12+
@extend .text-body-medium-regular;
13+
@extend .ml-32;
14+
}
15+
}

0 commit comments

Comments
 (0)