-
Notifications
You must be signed in to change notification settings - Fork 34
Fix labs header details alignment #14539
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
Changes from all commits
62544da
66076e7
7496862
1cf4165
e9ea4c8
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 |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| import { css } from '@emotion/react'; | ||
| import { from } from '@guardian/source/foundations'; | ||
| import type { Meta, StoryObj } from '@storybook/react'; | ||
| import { userEvent, within } from '@storybook/test'; | ||
| import { splitTheme } from '../../.storybook/decorators/splitThemeDecorator'; | ||
| import { | ||
| ArticleDesign, | ||
| ArticleDisplay, | ||
| ArticleSpecial, | ||
| } from '../lib/articleFormat'; | ||
| defaultFormats, | ||
| splitTheme, | ||
| } from '../../.storybook/decorators/splitThemeDecorator'; | ||
| import { LabsSectionHeader } from './LabsSectionHeader'; | ||
|
|
||
| const meta = { | ||
|
|
@@ -15,24 +15,34 @@ const meta = { | |
| title: 'Container Title', | ||
| url: '/', | ||
| }, | ||
| render: (args) => <LabsSectionHeader {...args} />, | ||
| render: (args) => ( | ||
| <div | ||
| css={css` | ||
| margin: 20px auto 100px; | ||
| min-width: 320px; | ||
| ${from.leftCol} { | ||
| min-width: auto; | ||
| max-width: 260px; | ||
| height: 400px; | ||
| } | ||
|
Comment on lines
+21
to
+27
Contributor
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. Centres the story and restricts the space available to bring it closer to how it looks when used inside the |
||
| `} | ||
| > | ||
| <LabsSectionHeader {...args} /> | ||
| </div> | ||
| ), | ||
| decorators: [ | ||
| splitTheme( | ||
| [ | ||
| { | ||
| theme: ArticleSpecial.Labs, | ||
| design: ArticleDesign.Feature, | ||
| display: ArticleDisplay.Standard, | ||
| }, | ||
| ], | ||
| { orientation: 'vertical' }, | ||
| ), | ||
| splitTheme([defaultFormats[0]], { | ||
| orientation: 'vertical', | ||
| hideFormatHeading: true, | ||
| }), | ||
| ], | ||
| } satisfies Meta<typeof LabsSectionHeader>; | ||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = {}; | ||
|
|
||
| export const WithDetailsOpen: Story = { | ||
| play: async ({ canvasElement }) => { | ||
| const canvas = within(canvasElement); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,14 @@ const aboutStyles = css` | |
| ${textSans14} | ||
| `; | ||
|
|
||
| const positionStyles = css` | ||
| right: 0; | ||
| ${from.leftCol} { | ||
| left: 0; | ||
| right: auto; | ||
| } | ||
| `; | ||
|
Comment on lines
+85
to
+91
Contributor
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 main fix in this PR is to adjust the positioning of the opened |
||
|
|
||
| const detailsStyles = css` | ||
| background-color: ${schemePalette('--labs-about-dropdown-background')}; | ||
| color: ${schemePalette('--labs-about-dropdown-text')}; | ||
|
|
@@ -101,9 +109,7 @@ export const LabsSectionHeader = ({ title, url }: Props) => ( | |
| <Details | ||
| label="About" | ||
| labelSize="xsmall" | ||
| positionStyles={css` | ||
| right: 0; | ||
| `} | ||
| positionStyles={positionStyles} | ||
| > | ||
| <div css={detailsStyles}> | ||
| <p> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds
hideFormatHeadingarg to the Split Theme decorator to allow omission of the format heading for non article storiesOptional arg and defaults to
falseso will not have an impact on any existing stories