Skip to content

Commit 7b9e933

Browse files
mic-webMichael Adlfinger
andauthored
feat: use font size from theme in Description component (#298)
* feat: let descriptions use theme font size * refactor: bold font weight --------- Co-authored-by: Michael Adlfinger <{ID}+{username}@users.noreply.github.com>
1 parent 32d7e2d commit 7b9e933

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/Descriptions/index.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ import {
22
Descriptions as AntdDescriptions,
33
DescriptionsProps as AntdDescriptionsProps,
44
} from 'antd';
5+
import styled from 'styled-components';
56

6-
export const Descriptions = AntdDescriptions;
7+
import { fontSizeFromTheme } from '../styled-utils';
8+
9+
const StyledDescriptions = styled(AntdDescriptions)`
10+
.mll-ant-descriptions-header {
11+
margin-bottom: 4px;
12+
}
13+
.mll-ant-descriptions-title {
14+
font-size: calc(${fontSizeFromTheme} + 1px);
15+
font-weight: bold;
16+
}
17+
.mll-ant-descriptions-item-label,
18+
.mll-ant-descriptions-item-content {
19+
font-size: ${fontSizeFromTheme};
20+
}
21+
`;
22+
23+
export const Descriptions: typeof AntdDescriptions = StyledDescriptions;
724
export type DescriptionsProps = AntdDescriptionsProps;

src/Provider/index.stories.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
Default as DefaultCollapseStory,
2424
Single as SingleCollapseStory,
2525
} from '../Collapse/index.stories';
26+
import { Default as DescriptionsStory } from '../Descriptions/index.stories';
2627
import { Form } from '../Form';
2728
import {
2829
TextArea as TextAreaStory,
@@ -47,17 +48,16 @@ import { Provider } from '.';
4748

4849
export default {
4950
title: 'Provider',
51+
args: {
52+
size: 'small',
53+
fontSize: '11px',
54+
},
5055
argTypes: {
5156
size: {
5257
control: {
5358
type: 'select',
54-
options: ['small', 'middle', 'large', undefined],
55-
defaultValue: 'small',
5659
},
57-
},
58-
fontSize: {
59-
control: { type: 'text' },
60-
defaultValue: '11px',
60+
options: ['small', 'middle', 'large', undefined],
6161
},
6262
},
6363
};
@@ -216,6 +216,7 @@ function SupportedComponents() {
216216
<CardsGridStory />
217217
<CardMetaStory />
218218
<StepsStory />
219+
<DescriptionsStory />
219220
</Space>
220221
);
221222
}

0 commit comments

Comments
 (0)