mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
Storybook: CSF Modal conversion (#24085)
* Convert modal * Update packages/grafana-ui/src/components/Modal/Modal.story.tsx Co-Authored-By: Alex Khomenko <Clarity-89@users.noreply.github.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
This commit is contained in:
parent
2e4a8d4d5a
commit
7b7c365018
@ -1,5 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { oneLineTrim } from 'common-tags';
|
||||
import { text, boolean } from '@storybook/addon-knobs';
|
||||
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
||||
@ -27,10 +26,13 @@ amet.`
|
||||
};
|
||||
};
|
||||
|
||||
const ModalStories = storiesOf('Overlays/Modal', module);
|
||||
ModalStories.addDecorator(withCenteredStory);
|
||||
export default {
|
||||
title: 'Overlays/Modal',
|
||||
component: Modal,
|
||||
decorators: [withCenteredStory],
|
||||
};
|
||||
|
||||
ModalStories.add('default', () => {
|
||||
export const basic = () => {
|
||||
const { body, visible } = getKnobs();
|
||||
return (
|
||||
<Modal
|
||||
@ -45,7 +47,7 @@ ModalStories.add('default', () => {
|
||||
{body}
|
||||
</Modal>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const tabs = [
|
||||
{ label: '1st child', value: 'first', active: true },
|
||||
@ -53,7 +55,7 @@ const tabs = [
|
||||
{ label: '3rd child', value: 'third', active: false },
|
||||
];
|
||||
|
||||
ModalStories.add('with tabs', () => {
|
||||
export const withTabs = () => {
|
||||
const [activeTab, setActiveTab] = useState('first');
|
||||
const modalHeader = (
|
||||
<ModalTabsHeader
|
||||
@ -83,4 +85,4 @@ ModalStories.add('with tabs', () => {
|
||||
}}
|
||||
</UseState>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ import { getModalStyles } from './getModalStyles';
|
||||
import { ModalHeader } from './ModalHeader';
|
||||
import { IconButton } from '../IconButton/IconButton';
|
||||
|
||||
interface Props extends Themeable {
|
||||
export interface Props extends Themeable {
|
||||
icon?: IconName;
|
||||
title: string | JSX.Element;
|
||||
className?: string;
|
||||
|
Loading…
Reference in New Issue
Block a user