All files / Accordion Accordion.stories.tsx

88.89% Statements 8/9
100% Branches 0/0
75% Functions 3/4
88.89% Lines 8/9

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                                1x 1x         1x 1x                                                             1x 1x   1x       1x                                                                
import React, { useState } from 'react';
import { Meta } from '@storybook/react';
import Accordion, { AccordionDumb } from './Accordion';
 
export default {
	title: 'Layout/Accordion',
	component: AccordionDumb,
	subcomponents: { 'Accordion.Item': Accordion.Item },
	parameters: {
		notes: AccordionDumb.peek.description,
		docs: {
			inlineStories: false,
		},
	},
} as Meta;
 
export const Default = () => (
	<Accordion>
		<Accordion.Item Header='Item 1'>Item 1 Content</Accordion.Item>
	</Accordion>
);
 
export const Basic = () => (
	<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'>
			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>
);
 
export const InitialIndexSet = () => {
	const [index, setIndex] = useState<number | null>(2);
 
	const handleChange = (index: number | null) => {
		setIndex(index);
	};
 
	return (
		<Accordion onSelect={handleChange} selectedIndex={index}>
			<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>
	);
};