diff --git a/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewerWithHighlight/PdfViewerWithHighlight.stories.tsx b/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewerWithHighlight/PdfViewerWithHighlight.stories.tsx index 864f76f0e..62e3b2cef 100644 --- a/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewerWithHighlight/PdfViewerWithHighlight.stories.tsx +++ b/packages/discovery-react-components/src/components/DocumentPreview/components/PdfViewerWithHighlight/PdfViewerWithHighlight.stories.tsx @@ -295,53 +295,51 @@ export default { decorators: [withKnobs] }; -export const Default = { - render: () => { - const page = number(pageKnob.label, pageKnob.defaultValue, pageKnob.options); - const zoom = radios(zoomKnob.label, zoomKnob.options, zoomKnob.defaultValue); - const scale = parseFloat(zoom); - const highlights = select( - highlightKnob.label, - highlightKnob.options, - highlightKnob.defaultValue - ); - const activeId = number('Active highlight index', 0); - const setLoadingAction = action('setLoading'); - const setCurrentPageAction = action('setCurrentPage'); - - const [currentPage, setCurrentPage] = useState(0); - useEffect(() => { - setCurrentPage(page); - }, [page]); - const handleSetCurrentPage = useCallback( - (p: number) => { - setCurrentPageAction(p); - setCurrentPage(p); - }, - [setCurrentPageAction] - ); +const DefaultStory: FC<{}> = () => { + const page = number(pageKnob.label, pageKnob.defaultValue, pageKnob.options); + const zoom = radios(zoomKnob.label, zoomKnob.options, zoomKnob.defaultValue); + const scale = parseFloat(zoom); + const highlights = select(highlightKnob.label, highlightKnob.options, highlightKnob.defaultValue); + const activeId = number('Active highlight index', 0); + const setLoadingAction = action('setLoading'); + const setCurrentPageAction = action('setCurrentPage'); + + const [currentPage, setCurrentPage] = useState(0); + useEffect(() => { + setCurrentPage(page); + }, [page]); + const handleSetCurrentPage = useCallback( + (p: number) => { + setCurrentPageAction(p); + setCurrentPage(p); + }, + [setCurrentPageAction] + ); - const [activeIds, setActiveIds] = useState([]); - useEffect(() => { - const items = highlightKnob.data[highlights]; - const item = items[activeId]; - setActiveIds(item?.id ? [item.id] : []); - }, [activeId, highlights]); + const [activeIds, setActiveIds] = useState([]); + useEffect(() => { + const items = highlightKnob.data[highlights]; + const item = items[activeId]; + setActiveIds(item?.id ? [item.id] : []); + }, [activeId, highlights]); - return ( - - ); - }, + return ( + + ); +}; + +export const Default = { + render: () => , name: 'default' };