Skip to content
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

Header: add overflow #4768

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/moody-rivers-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Header: Add overflow when there are a lot of items
27 changes: 27 additions & 0 deletions packages/react/src/Header/Header.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React from 'react'
import type {Meta} from '@storybook/react'

import Header from './Header'
import Avatar from '../Avatar'
import Octicon from '../Octicon'
import {MarkGithubIcon} from '@primer/octicons-react'

export default {
title: 'Components/Header/Features',
Expand Down Expand Up @@ -29,3 +32,27 @@ export const WithLinks = () => (
</Header.Item>
</Header>
)

export const WithManyItems = () => (
<Header>
<Header.Item>
<Header.Link href="#" sx={{fontSize: 2}}>
<Octicon icon={MarkGithubIcon} size={32} sx={{mr: 2}} />
<span>GitHub</span>
</Header.Link>
</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item>Item</Header.Item>
<Header.Item sx={{mr: 0}}>
<Avatar src="https://github.com/octocat.png" size={20} square alt="@octocat" />
</Header.Item>
</Header>
)
1 change: 1 addition & 0 deletions packages/react/src/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const Header = styled.header<StyledHeaderProps>`
background-color: ${get('colors.header.bg')};
align-items: center;
flex-wrap: nowrap;
overflow: auto;

${sx};
`
Expand Down
Loading