Skip to content

Commit

Permalink
feat(PluginTitle): add xl size (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaryaLari authored Dec 17, 2024
1 parent 7f71c6a commit 7e1ab84
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/plugins/Title/Title.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
padding-bottom: 5px;
padding-right: 5px;

&_size_xl {
font-size: 32px;
line-height: 40px;
}

&_size_l {
font-size: 24px;
line-height: 28px;
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/Title/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import {PLUGIN_ROOT_ATTR_NAME} from '../constants';

import './Title.scss';

export type PluginTitleSize = 'xl' | 'l' | 'm' | 's' | 'xs';

export interface PluginTitleProps extends PluginWidgetProps {
data: {
size: 'l' | 'm' | 's' | 'xs';
size: PluginTitleSize;
text: string;
showInTOC: boolean;
} & PluginWidgetProps['data'];
Expand Down
29 changes: 29 additions & 0 deletions src/plugins/Title/__stories__/Title.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';

import {Flex} from '@gravity-ui/uikit';
import {Meta, StoryObj} from '@storybook/react';

import {PluginTitle, PluginTitleSize} from '../Title';

export default {
title: 'Components/Title',
component: PluginTitle,
} as Meta;

type Story = StoryObj<typeof PluginTitle>;

const sizes: PluginTitleSize[] = ['xs', 's', 'm', 'l', 'xl'];

export const Size: Story = {
render: ({data: _, ...args}) => (
<Flex direction="column" gap={2}>
{sizes.map((size) => (
<PluginTitle
key={size}
data={{size, text: `Title size=${size}`, showInTOC: true}}
{...args}
/>
))}
</Flex>
),
};

0 comments on commit 7e1ab84

Please sign in to comment.