|
| 1 | +import type { Meta, StoryObj } from '@storybook/react'; |
| 2 | +import { FlexBox, FlexBoxAlignItems, FlexBoxJustifyContent, Text } from '@ui5/webcomponents-react'; |
| 3 | +import { ThemingParameters } from '@ui5/webcomponents-react-base'; |
| 4 | +import React from 'react'; |
| 5 | +import { RadialChart } from './RadialChart.js'; |
| 6 | + |
| 7 | +const meta = { |
| 8 | + title: 'RadialChart', |
| 9 | + component: RadialChart, |
| 10 | + args: { displayValue: '50%', value: 50, maxValue: 100 } |
| 11 | +} satisfies Meta<typeof RadialChart>; |
| 12 | + |
| 13 | +export default meta; |
| 14 | +type Story = StoryObj<typeof meta>; |
| 15 | + |
| 16 | +export const Default: Story = {}; |
| 17 | + |
| 18 | +export const WithCustomColor: Story = { |
| 19 | + args: { |
| 20 | + color: '#f0ab00' |
| 21 | + } |
| 22 | +}; |
| 23 | + |
| 24 | +export const MicroRadialCharts: Story = { |
| 25 | + render: (args) => { |
| 26 | + return ( |
| 27 | + <FlexBox justifyContent={FlexBoxJustifyContent.SpaceBetween} alignItems={FlexBoxAlignItems.Center}> |
| 28 | + <RadialChart |
| 29 | + value={50} |
| 30 | + style={{ height: '50px', width: '50px' }} |
| 31 | + chartConfig={{ innerRadius: '75%', margin: { top: 0, right: 0, bottom: 0, left: 0 } }} |
| 32 | + displayValue={'50%'} |
| 33 | + displayValueStyle={{ |
| 34 | + fontSize: ThemingParameters.sapFontSmallSize, |
| 35 | + fill: ThemingParameters.sapChart_OrderedColor_1 |
| 36 | + }} |
| 37 | + /> |
| 38 | + <FlexBox alignItems={FlexBoxAlignItems.Center}> |
| 39 | + <RadialChart |
| 40 | + value={50} |
| 41 | + style={{ width: '25px', height: '25px' }} |
| 42 | + chartConfig={{ innerRadius: '70%', margin: { top: 0, right: 0, bottom: 0, left: 0 } }} |
| 43 | + /> |
| 44 | + <Text>50%</Text> |
| 45 | + </FlexBox> |
| 46 | + <FlexBox alignItems={FlexBoxAlignItems.Center}> |
| 47 | + <RadialChart |
| 48 | + value={50} |
| 49 | + style={{ height: '16px', width: '16px' }} |
| 50 | + chartConfig={{ innerRadius: '75%', margin: { top: 0, right: 0, bottom: 0, left: 0 } }} |
| 51 | + /> |
| 52 | + <Text style={{ fontSize: ThemingParameters.sapFontSmallSize }}>50%</Text> |
| 53 | + </FlexBox> |
| 54 | + </FlexBox> |
| 55 | + ); |
| 56 | + } |
| 57 | +}; |
0 commit comments