From af0e6a3e55ebf83900fbd87caaf478af89616f66 Mon Sep 17 00:00:00 2001 From: Deen Denno Date: Sun, 25 Jul 2021 17:45:16 -0500 Subject: [PATCH 01/21] feat(wip): skip to content/sidebar links --- .../src/components/preview/FramesRenderer.tsx | 17 ++++- .../components/sidebar/Heading.stories.tsx | 9 +++ lib/ui/src/components/sidebar/Heading.tsx | 23 ++++++ .../src/components/sidebar/Tree.stories.tsx | 19 +++++ lib/ui/src/components/sidebar/Tree.tsx | 72 +++++++++++++------ .../components/sidebar/TreeNode.stories.tsx | 3 + lib/ui/src/components/sidebar/TreeNode.tsx | 3 +- 7 files changed, 124 insertions(+), 22 deletions(-) diff --git a/lib/ui/src/components/preview/FramesRenderer.tsx b/lib/ui/src/components/preview/FramesRenderer.tsx index f441a74bd8c..9695b985146 100644 --- a/lib/ui/src/components/preview/FramesRenderer.tsx +++ b/lib/ui/src/components/preview/FramesRenderer.tsx @@ -1,5 +1,6 @@ import React, { Fragment, FunctionComponent, useMemo, useEffect, useState } from 'react'; -import { Global, CSSObject } from '@storybook/theming'; +import { Button } from '@storybook/components'; +import { Global, CSSObject, styled } from '@storybook/theming'; import { IFrame } from './iframe'; import { FramesRendererProps } from './utils/types'; import { stringifyQueryParams } from './utils/stringifyQueryParams'; @@ -12,6 +13,17 @@ const getActive = (refId: FramesRendererProps['refId']) => { return 'storybook-preview-iframe'; }; +const SkipToContentLink = styled(Button)(({ theme }) => ({ + position: 'absolute', + top: '10px', + right: '15px', + padding: '10px 15px', + fontSize: theme.typography.size.s1, + '&:focus': { + zIndex: 2, + }, +})); + export const FramesRenderer: FunctionComponent = ({ refs, story, @@ -74,6 +86,9 @@ export const FramesRenderer: FunctionComponent = ({ {Object.entries(frames).map(([id, src]) => ( + + Skip to sidebar +