Upgrade Storybook

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Jamie Kyle 2023-10-11 12:06:43 -07:00 committed by GitHub
parent 8c966dfbd8
commit 502ea174ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
328 changed files with 10863 additions and 12432 deletions

View file

@ -2,11 +2,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState } from 'react';
import { action } from '@storybook/addon-actions';
import { number } from '@storybook/addon-knobs';
import { noop } from 'lodash';
import type { Meta } from '@storybook/react';
import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './Lightbox';
import { Lightbox } from './Lightbox';
@ -26,7 +24,9 @@ const i18n = setupI18n('en', enMessages);
export default {
title: 'Components/Lightbox',
};
argTypes: {},
args: {},
} satisfies Meta<PropsType>;
type OverridePropsMediaItemType = Partial<MediaItemType> & { caption?: string };
@ -57,9 +57,7 @@ function createMediaItem(
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const [selectedIndex, setSelectedIndex] = useState(
number('selectedIndex', overrideProps.selectedIndex || 0)
);
const [selectedIndex, setSelectedIndex] = useState(0);
const media = overrideProps.media || [];
return {
closeLightbox: action('closeLightbox'),
@ -196,10 +194,6 @@ export function ImageWithCaptionNormalImage(): JSX.Element {
);
}
ImageWithCaptionNormalImage.story = {
name: 'Image with Caption (normal image)',
};
export function ImageWithCaptionAllWhiteImage(): JSX.Element {
return (
<Lightbox
@ -216,10 +210,6 @@ export function ImageWithCaptionAllWhiteImage(): JSX.Element {
);
}
ImageWithCaptionAllWhiteImage.story = {
name: 'Image with Caption (all-white image)',
};
export function SingleVideo(): JSX.Element {
return (
<Lightbox
@ -252,10 +242,6 @@ export function SingleVideoWCaption(): JSX.Element {
);
}
SingleVideoWCaption.story = {
name: 'Single Video w/caption',
};
export function UnsupportedImageType(): JSX.Element {
return (
<Lightbox
@ -318,10 +304,6 @@ export function CustomChildren(): JSX.Element {
);
}
CustomChildren.story = {
name: 'Custom children',
};
export function ConversationHeader(): JSX.Element {
return (
<Lightbox