-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: Improve empty state of addon panel
- Loading branch information
Showing
11 changed files
with
259 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
code/ui/components/src/components/tabs/EmptyTabContent.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import type { EmptyTabContent } from './EmptyTabContent'; | ||
import { DocumentIcon } from '@storybook/icons'; | ||
import { Link } from '@storybook/components'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
const EmptyComponent = () => ''; | ||
|
||
export default { | ||
component: EmptyComponent, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof EmptyTabContent>; | ||
|
||
type Story = StoryObj<typeof EmptyTabContent>; | ||
|
||
export const EmptyStuff = { | ||
render: () => { | ||
return <div></div>; | ||
}, | ||
}; | ||
|
||
export const OnlyTitle: Story = { | ||
args: { | ||
title: 'Nothing found', | ||
}, | ||
}; | ||
|
||
export const TitleAndDescription: Story = { | ||
args: { | ||
title: 'Nothing found', | ||
description: 'Sorry, there is nothing to display here.', | ||
}, | ||
}; | ||
|
||
export const CustomFooter: Story = { | ||
args: { | ||
title: 'Nothing found', | ||
description: 'Sorry, there is nothing to display here.', | ||
footer: ( | ||
<Link href="foo" withArrow> | ||
<DocumentIcon /> See the docs | ||
</Link> | ||
), | ||
}, | ||
}; |
52 changes: 52 additions & 0 deletions
52
code/ui/components/src/components/tabs/EmptyTabContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import { styled } from '@storybook/theming'; | ||
|
||
const Wrapper = styled.div(({ theme }) => ({ | ||
height: '100%', | ||
display: 'flex', | ||
padding: 30, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
flexDirection: 'column', | ||
gap: 15, | ||
background: theme.background.content, | ||
})); | ||
|
||
const Content = styled.div({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 4, | ||
maxWidth: 415, | ||
}); | ||
|
||
const Title = styled.div(({ theme }) => ({ | ||
fontWeight: theme.typography.weight.bold, | ||
fontSize: theme.typography.size.s2 - 1, | ||
textAlign: 'center', | ||
color: theme.textColor, | ||
})); | ||
|
||
const Description = styled.div(({ theme }) => ({ | ||
fontWeight: theme.typography.weight.regular, | ||
fontSize: theme.typography.size.s2 - 1, | ||
textAlign: 'center', | ||
color: theme.textMutedColor, | ||
})); | ||
|
||
interface Props { | ||
title: React.ReactNode; | ||
description?: React.ReactNode; | ||
footer?: React.ReactNode; | ||
} | ||
|
||
export const EmptyTabContent = ({ title, description, footer }: Props) => { | ||
return ( | ||
<Wrapper> | ||
<Content> | ||
<Title>{title}</Title> | ||
{description && <Description>{description}</Description>} | ||
</Content> | ||
{footer} | ||
</Wrapper> | ||
); | ||
}; |
Oops, something went wrong.