All files / Accordion Accordion.stories.tsx

100% Statements 15/15
100% Branches 0/0
100% Functions 6/6
100% Lines 15/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150                                      1x 1x   1x                                                                     1x   1x     1x 1x   1x                                                                     1x   1x     1x 1x   1x                                                                           1x   1x  
import React from 'react';
 
import createClass from 'create-react-class';
import { Story, Meta } from '@storybook/react';
import Accordion from './Accordion';
 
export default {
	title: 'Layout/Accordion',
	component: Accordion,
	parameters: {
		docs: {
			description: {
				component: (Accordion as any).peek.description,
			},
		},
	},
} as Meta;
 
/* Fixed Index */
export const FixedIndex: Story = () => {
	const Component = createClass({
		render() {
			return (
				<Accordion selectedIndex={1}>
					<Accordion.Item Header='Peter Venkman'>
						Peter Venkman, Ph.D. is a fictional character from the Ghostbusters
						franchise. He appears in the films Ghostbusters and Ghostbusters II
						and in the animated television series The Real Ghostbusters. In both
						live action films, he was portrayed by Bill Murray, and was voiced
						in the animated series first by Lorenzo Music and then by Dave
						Coulier. He is a parapsychologist and the leader of the
						Ghostbusters.
					</Accordion.Item>
					<Accordion.Item Header='Ray Stantz'>
						Raymond Ray Stantz, Ph.D. is a fictional character from the
						Ghostbusters franchise. He appears in the films Ghostbusters,
						Ghostbusters II, Casper, and the animated television series The Real
						Ghostbusters. He was portrayed by Dan Aykroyd in both live action
						films, and voiced by Frank Welker in the animated series. He is a
						member of the Ghostbusters and one of the three doctors of
						parapsychology, along with Dr. Peter Venkman and Dr. Egon Spengler.
					</Accordion.Item>
					<Accordion.Item Header='Egon Spengler'>
						Egon Spengler, Ph.D. is a fictional character from the Ghostbusters
						franchise. He appears in the films Ghostbusters and Ghostbusters II,
						in the animated television series The Real Ghostbusters, and later
						in Extreme Ghostbusters. Spengler was portrayed by Harold Ramis in
						the films and voiced by him in Ghostbusters: The Video Game, and
						voiced by Maurice LaMarche in the cartoon series. He is a member of
						the Ghostbusters and one of the three doctors of parapsychology,
						along with Dr. Peter Venkman and Dr. Raymond Stantz.
					</Accordion.Item>
				</Accordion>
			);
		},
	});
 
	return <Component />;
};
FixedIndex.storyName = 'FixedIndex';
 
/* Disabled Item */
export const DisabledItem = () => {
	const Component = createClass({
		render() {
			return (
				<Accordion>
					<Accordion.Item Header='Peter Venkman'>
						Peter Venkman, Ph.D. is a fictional character from the Ghostbusters
						franchise. He appears in the films Ghostbusters and Ghostbusters II
						and in the animated television series The Real Ghostbusters. In both
						live action films, he was portrayed by Bill Murray, and was voiced
						in the animated series first by Lorenzo Music and then by Dave
						Coulier. He is a parapsychologist and the leader of the
						Ghostbusters.
					</Accordion.Item>
					<Accordion.Item Header='Ray Stantz' isDisabled={true}>
						Raymond Ray Stantz, Ph.D. is a fictional character from the
						Ghostbusters franchise. He appears in the films Ghostbusters,
						Ghostbusters II, Casper, and the animated television series The Real
						Ghostbusters. He was portrayed by Dan Aykroyd in both live action
						films, and voiced by Frank Welker in the animated series. He is a
						member of the Ghostbusters and one of the three doctors of
						parapsychology, along with Dr. Peter Venkman and Dr. Egon Spengler.
					</Accordion.Item>
					<Accordion.Item Header='Egon Spengler'>
						Egon Spengler, Ph.D. is a fictional character from the Ghostbusters
						franchise. He appears in the films Ghostbusters and Ghostbusters II,
						in the animated television series The Real Ghostbusters, and later
						in Extreme Ghostbusters. Spengler was portrayed by Harold Ramis in
						the films and voiced by him in Ghostbusters: The Video Game, and
						voiced by Maurice LaMarche in the cartoon series. He is a member of
						the Ghostbusters and one of the three doctors of parapsychology,
						along with Dr. Peter Venkman and Dr. Raymond Stantz.
					</Accordion.Item>
				</Accordion>
			);
		},
	});
 
	return <Component />;
};
DisabledItem.storyName = 'DisabledItem';
 
/* Using Header As Child */
export const UsingHeaderAsChild = () => {
	const Component = createClass({
		render() {
			return (
				<Accordion>
					<Accordion.Item>
						<Accordion.Header>Peter Venkman</Accordion.Header>
						Peter Venkman, Ph.D. is a fictional character from the Ghostbusters
						franchise. He appears in the films Ghostbusters and Ghostbusters II
						and in the animated television series The Real Ghostbusters. In both
						live action films, he was portrayed by Bill Murray, and was voiced
						in the animated series first by Lorenzo Music and then by Dave
						Coulier. He is a parapsychologist and the leader of the
						Ghostbusters.
					</Accordion.Item>
					<Accordion.Item isDisabled={true}>
						<Accordion.Header>Ray Stantz</Accordion.Header>
						Raymond Ray Stantz, Ph.D. is a fictional character from the
						Ghostbusters franchise. He appears in the films Ghostbusters,
						Ghostbusters II, Casper, and the animated television series The Real
						Ghostbusters. He was portrayed by Dan Aykroyd in both live action
						films, and voiced by Frank Welker in the animated series. He is a
						member of the Ghostbusters and one of the three doctors of
						parapsychology, along with Dr. Peter Venkman and Dr. Egon Spengler.
					</Accordion.Item>
					<Accordion.Item>
						<Accordion.Header>Egon Spengler</Accordion.Header>
						Egon Spengler, Ph.D. is a fictional character from the Ghostbusters
						franchise. He appears in the films Ghostbusters and Ghostbusters II,
						in the animated television series The Real Ghostbusters, and later
						in Extreme Ghostbusters. Spengler was portrayed by Harold Ramis in
						the films and voiced by him in Ghostbusters: The Video Game, and
						voiced by Maurice LaMarche in the cartoon series. He is a member of
						the Ghostbusters and one of the three doctors of parapsychology,
						along with Dr. Peter Venkman and Dr. Raymond Stantz.
					</Accordion.Item>
				</Accordion>
			);
		},
	});
 
	return <Component />;
};
UsingHeaderAsChild.storyName = 'UsingHeaderAsChild';