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

Fix for SelectPanel Filter width #1742

Merged
merged 4 commits into from
Dec 17, 2021
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/shaggy-hounds-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Fix for SelectPanel Filter width
71 changes: 71 additions & 0 deletions src/FilteredActionList/FilteredActionList.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import {Meta} from '@storybook/react'
import React from 'react'
import {ThemeProvider} from '..'
import {FilteredActionList} from '../FilteredActionList'
import BaseStyles from '../BaseStyles'
import Box from '../Box'

const meta: Meta = {
title: 'Composite components/FilteredActionList',
component: FilteredActionList,
decorators: [
(Story: React.ComponentType): JSX.Element => (
<ThemeProvider>
<BaseStyles>
<Story />
</BaseStyles>
</ThemeProvider>
)
],
parameters: {
controls: {
disable: true
}
}
}
export default meta

function getColorCircle(color: string) {
return function () {
return (
<Box
bg={color}
borderColor={color}
width={14}
height={14}
borderRadius={10}
margin="auto"
borderWidth="1px"
borderStyle="solid"
/>
)
}
}

const items = [
{leadingVisual: getColorCircle('#a2eeef'), text: 'enhancement', id: 1},
{leadingVisual: getColorCircle('#d73a4a'), text: 'bug', id: 2},
{leadingVisual: getColorCircle('#0cf478'), text: 'good first issue', id: 3},
{leadingVisual: getColorCircle('#ffd78e'), text: 'design', id: 4},
{leadingVisual: getColorCircle('#ff0000'), text: 'blocker', id: 5},
{leadingVisual: getColorCircle('#a4f287'), text: 'backend', id: 6},
{leadingVisual: getColorCircle('#8dc6fc'), text: 'frontend', id: 7}
]

export function Default(): JSX.Element {
const [filter, setFilter] = React.useState('')
const filteredItems = items.filter(item => item.text.toLowerCase().startsWith(filter.toLowerCase()))

return (
<>
<h1>Filtered Action List</h1>
<div>Please select labels that describe your issue:</div>
<FilteredActionList
placeholderText="Filter Labels"
items={filteredItems}
onFilterChange={setFilter}
sx={{border: '1px solid', padding: '8px'}}
/>
</>
)
}
1 change: 1 addition & 0 deletions src/_TextInputWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ const TextInputWrapper = styled.span<StyledWrapperProps>`
props.block &&
css`
width: 100%;
display: flex;
`}

// Ensures inputs don' t zoom on mobile but are body-font size on desktop
Expand Down
4 changes: 4 additions & 0 deletions src/__tests__/__snapshots__/TextInput.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ exports[`TextInput renders block 1`] = `
padding-left: 0;
padding-right: 0;
width: 100%;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}

.c0 >:not(:last-child) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ exports[`TextInputWithTokens renders as block layout 1`] = `
padding-left: 0;
padding-right: 0;
width: 100%;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
padding-left: 12px;
padding-top: calc(12px / 2);
padding-bottom: calc(12px / 2);
Expand Down