-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a story showing platform logos (#1277)
* add a story showing platform logos * when running storybook in docker, do not start browser
- Loading branch information
1 parent
7775240
commit 6a8dcc5
Showing
3 changed files
with
61 additions
and
1 deletion.
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
59 changes: 59 additions & 0 deletions
59
frontends/ol-components/src/components/Logo/Logo.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,59 @@ | ||
import React from "react" | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
import { PlatformLogo, PLATFORMS } from "./Logo" | ||
import Grid from "@mui/material/Grid" | ||
import styled from "@emotion/styled" | ||
import { PlatformEnum } from "api" | ||
|
||
type StoryProps = { showIconBackground?: boolean; iconHeight?: string } | ||
const SizedPlatformLogo = styled(PlatformLogo)<StoryProps>( | ||
({ showIconBackground }) => [ | ||
{ | ||
height: "27px", | ||
}, | ||
showIconBackground && { | ||
backgroundColor: "pink", | ||
}, | ||
], | ||
) | ||
|
||
const meta: Meta<StoryProps> = { | ||
title: "smoot-design/PlatformLogo", | ||
render: ({ showIconBackground, iconHeight }) => { | ||
return ( | ||
<Grid container rowSpacing="12px"> | ||
<Grid item xs={12}> | ||
<strong>Note</strong>: the <code>showIconBackground</code> and{" "} | ||
<code>iconHeight</code> | ||
args are only for this story. Not applicable to the actual component. | ||
</Grid> | ||
{Object.entries(PLATFORMS).map(([platformCode, platform]) => ( | ||
<React.Fragment key={platformCode}> | ||
<Grid item xs={2}> | ||
<code>{platformCode}</code> | ||
</Grid> | ||
<Grid item xs={2}> | ||
{platform.name} | ||
</Grid> | ||
<Grid item xs={8}> | ||
<SizedPlatformLogo | ||
iconHeight={iconHeight} | ||
showIconBackground={showIconBackground} | ||
platformCode={platformCode as PlatformEnum} | ||
/> | ||
</Grid> | ||
</React.Fragment> | ||
))} | ||
</Grid> | ||
) | ||
}, | ||
args: { | ||
showIconBackground: false, | ||
iconHeight: "35px", | ||
}, | ||
} | ||
export default meta | ||
|
||
type Story = StoryObj<StoryProps> | ||
|
||
export const All: Story = {} |