-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
storybook: correct sidebar links #104522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storybook: correct sidebar links #104522
Changes from all commits
c25aef8
533f1e4
f4e762d
091b5ad
1e07651
76c03e1
8533d38
91e1f28
2b5b8f2
14e377b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import type {PropsWithChildren} from 'react'; | |
| import {Fragment} from 'react'; | ||
| import {useTheme} from '@emotion/react'; | ||
| import styled from '@emotion/styled'; | ||
| import type {LocationDescriptor} from 'history'; | ||
|
|
||
| import performanceWaitingForSpan from 'sentry-images/spot/performance-waiting-for-span.svg'; | ||
| import heroImg from 'sentry-images/stories/landing/robopigeon.png'; | ||
|
|
@@ -13,6 +14,8 @@ import {Link} from 'sentry/components/core/link'; | |
| import {IconOpen} from 'sentry/icons'; | ||
| import {Acronym} from 'sentry/stories/view/landing/acronym'; | ||
| import {StoryDarkModeProvider} from 'sentry/stories/view/useStoriesDarkMode'; | ||
| import normalizeUrl from 'sentry/utils/url/normalizeUrl'; | ||
| import useOrganization from 'sentry/utils/useOrganization'; | ||
|
|
||
| import {Colors, Icons, Typography} from './figures'; | ||
|
|
||
|
|
@@ -29,7 +32,7 @@ const frontmatter = { | |
| actions: [ | ||
| { | ||
| children: 'Get Started', | ||
| to: '/stories?name=app/styles/colors.mdx', | ||
| to: '/stories/foundations/colors', | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are there no trailing
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current stories don't use them either, so this isn't a breaking change. That said, I'll open a PR to add support for it separately so that this remains django compat |
||
| priority: 'primary', | ||
| }, | ||
| { | ||
|
|
@@ -43,6 +46,8 @@ const frontmatter = { | |
| }; | ||
|
|
||
| export function StoryLanding() { | ||
| const organization = useOrganization(); | ||
|
|
||
| return ( | ||
| <Fragment> | ||
| <StoryDarkModeProvider> | ||
|
|
@@ -57,9 +62,14 @@ export function StoryLanding() { | |
| <p>{frontmatter.hero.tagline}</p> | ||
| </Flex> | ||
| <Flex gap="md"> | ||
| {frontmatter.hero.actions.map(props => ( | ||
| <LinkButton {...props} key={props.to} /> | ||
| ))} | ||
| {frontmatter.hero.actions.map(props => { | ||
| // Normalize internal paths with organization context | ||
| const to = | ||
| typeof props.to === 'string' && !props.external | ||
| ? normalizeUrl(`/organizations/${organization.slug}${props.to}`) | ||
| : props.to; | ||
| return <LinkButton {...props} to={to} key={props.to} />; | ||
| })} | ||
| </Flex> | ||
| </Flex> | ||
| <img | ||
|
|
@@ -86,25 +96,50 @@ export function StoryLanding() { | |
| </p> | ||
| </Flex> | ||
| <CardGrid> | ||
| <Card href="/stories?name=app/styles/colors.mdx" title="Color"> | ||
| <Card | ||
| to={{ | ||
| pathname: normalizeUrl( | ||
| `/organizations/${organization.slug}/stories/foundations/colors` | ||
| ), | ||
| }} | ||
| title="Color" | ||
| > | ||
| <CardFigure> | ||
| <Colors /> | ||
| </CardFigure> | ||
| </Card> | ||
| <Card href="/stories/?name=app%2Ficons%2Ficons.stories.tsx" title="Icons"> | ||
| <Card | ||
| to={{ | ||
| pathname: normalizeUrl( | ||
| `/organizations/${organization.slug}/stories/foundations/icons` | ||
| ), | ||
| }} | ||
| title="Icons" | ||
| > | ||
| <CardFigure> | ||
| <Icons /> | ||
| </CardFigure> | ||
| </Card> | ||
| <Card | ||
| href="/stories/?name=app%2Fstyles%2Ftypography.stories.tsx" | ||
| to={{ | ||
| pathname: normalizeUrl( | ||
| `/organizations/${organization.slug}/stories/foundations/typography` | ||
| ), | ||
| }} | ||
| title="Typography" | ||
| > | ||
| <CardFigure> | ||
| <Typography /> | ||
| </CardFigure> | ||
| </Card> | ||
| <Card href="/stories/?name=app%2Fstyles%2Fimages.stories.tsx" title="Images"> | ||
| <Card | ||
| to={{ | ||
| pathname: normalizeUrl( | ||
| `/organizations/${organization.slug}/stories/foundations/images` | ||
| ), | ||
| }} | ||
| title="Images" | ||
| > | ||
| <CardFigure> | ||
| <img src={performanceWaitingForSpan} /> | ||
| </CardFigure> | ||
|
|
@@ -192,12 +227,13 @@ const CardGrid = styled('div')` | |
|
|
||
| interface CardProps { | ||
| children: React.ReactNode; | ||
| href: string; | ||
| title: string; | ||
| to: LocationDescriptor; | ||
| } | ||
|
|
||
| function Card(props: CardProps) { | ||
| return ( | ||
| <CardLink to={props.href}> | ||
| <CardLink to={props.to}> | ||
| {props.children} | ||
| <CardTitle>{props.title}</CardTitle> | ||
| </CardLink> | ||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.