All files / ExpanderPanel ExpanderPanel.stories.tsx

90.9% Statements 10/11
100% Branches 0/0
85.71% Functions 6/7
90.9% Lines 10/11

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                                        1x 1x       100x             1x 1x       100x             1x 1x       1x       100x          
import _ from 'lodash';
import React from 'react';
import { Story, Meta } from '@storybook/react';
 
import ExpanderPanel, { IExpanderPanelProps } from './ExpanderPanel';
 
export default {
	title: 'Layout/ExpanderPanel',
	component: ExpanderPanel,
	parameters: {
		docs: {
			description: {
				component: ExpanderPanel.peek.description,
			},
		},
	},
	args: ExpanderPanel.defaultProps,
} as Meta;
 
/* Basic */
export const Basic: Story<IExpanderPanelProps> = (args) => {
	return (
		<ExpanderPanel {...args}>
			<ExpanderPanel.Header>Show More</ExpanderPanel.Header>
			{_.times(100, (n) => (
				<div key={n}>{_.repeat('-', 75 * Math.sin(n / 5))}</div>
			))}
		</ExpanderPanel>
	);
};
 
/* No Padding */
export const NoPadding: Story<IExpanderPanelProps> = (args) => {
	return (
		<ExpanderPanel {...args} hasPadding={false}>
			<ExpanderPanel.Header>Show More</ExpanderPanel.Header>
			{_.times(100, (n) => (
				<div key={n}>{_.repeat('-', 75 * Math.sin(n / 5))}</div>
			))}
		</ExpanderPanel>
	);
};
 
/* Basic With On Rest Callback */
export const BasicWithOnRestCallback: Story<IExpanderPanelProps> = (args) => {
	const onRest = () => {
		alert('A big ball of wibbly wobbly, timey wimey stuff');
	};
 
	return (
		<ExpanderPanel {...args} onRest={onRest}>
			<ExpanderPanel.Header>Show More</ExpanderPanel.Header>
			{_.times(100, (n) => (
				<div key={n}>{_.repeat('-', 75 * Math.sin(n / 5))}</div>
			))}
		</ExpanderPanel>
	);
};