Skip to content

Commit 4ab78a2

Browse files
authored
Fix for SelectPanel Filter width (#1742)
* Fix for SelectPanel Filter width * Lint issues * Create shaggy-hounds-decide.md
1 parent 3d5fafd commit 4ab78a2

File tree

5 files changed

+85
-0
lines changed

5 files changed

+85
-0
lines changed

.changeset/shaggy-hounds-decide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Fix for SelectPanel Filter width
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import {Meta} from '@storybook/react'
2+
import React from 'react'
3+
import {ThemeProvider} from '..'
4+
import {FilteredActionList} from '../FilteredActionList'
5+
import BaseStyles from '../BaseStyles'
6+
import Box from '../Box'
7+
8+
const meta: Meta = {
9+
title: 'Composite components/FilteredActionList',
10+
component: FilteredActionList,
11+
decorators: [
12+
(Story: React.ComponentType): JSX.Element => (
13+
<ThemeProvider>
14+
<BaseStyles>
15+
<Story />
16+
</BaseStyles>
17+
</ThemeProvider>
18+
)
19+
],
20+
parameters: {
21+
controls: {
22+
disable: true
23+
}
24+
}
25+
}
26+
export default meta
27+
28+
function getColorCircle(color: string) {
29+
return function () {
30+
return (
31+
<Box
32+
bg={color}
33+
borderColor={color}
34+
width={14}
35+
height={14}
36+
borderRadius={10}
37+
margin="auto"
38+
borderWidth="1px"
39+
borderStyle="solid"
40+
/>
41+
)
42+
}
43+
}
44+
45+
const items = [
46+
{leadingVisual: getColorCircle('#a2eeef'), text: 'enhancement', id: 1},
47+
{leadingVisual: getColorCircle('#d73a4a'), text: 'bug', id: 2},
48+
{leadingVisual: getColorCircle('#0cf478'), text: 'good first issue', id: 3},
49+
{leadingVisual: getColorCircle('#ffd78e'), text: 'design', id: 4},
50+
{leadingVisual: getColorCircle('#ff0000'), text: 'blocker', id: 5},
51+
{leadingVisual: getColorCircle('#a4f287'), text: 'backend', id: 6},
52+
{leadingVisual: getColorCircle('#8dc6fc'), text: 'frontend', id: 7}
53+
]
54+
55+
export function Default(): JSX.Element {
56+
const [filter, setFilter] = React.useState('')
57+
const filteredItems = items.filter(item => item.text.toLowerCase().startsWith(filter.toLowerCase()))
58+
59+
return (
60+
<>
61+
<h1>Filtered Action List</h1>
62+
<div>Please select labels that describe your issue:</div>
63+
<FilteredActionList
64+
placeholderText="Filter Labels"
65+
items={filteredItems}
66+
onFilterChange={setFilter}
67+
sx={{border: '1px solid', padding: '8px'}}
68+
/>
69+
</>
70+
)
71+
}

src/_TextInputWrapper.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ const TextInputWrapper = styled.span<StyledWrapperProps>`
135135
props.block &&
136136
css`
137137
width: 100%;
138+
display: flex;
138139
`}
139140
140141
// Ensures inputs don' t zoom on mobile but are body-font size on desktop

src/__tests__/__snapshots__/TextInput.test.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ exports[`TextInput renders block 1`] = `
123123
padding-left: 0;
124124
padding-right: 0;
125125
width: 100%;
126+
display: -webkit-box;
127+
display: -webkit-flex;
128+
display: -ms-flexbox;
129+
display: flex;
126130
}
127131
128132
.c0 >:not(:last-child) {

src/__tests__/__snapshots__/TextInputWithTokens.test.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ exports[`TextInputWithTokens renders as block layout 1`] = `
452452
padding-left: 0;
453453
padding-right: 0;
454454
width: 100%;
455+
display: -webkit-box;
456+
display: -webkit-flex;
457+
display: -ms-flexbox;
458+
display: flex;
455459
padding-left: 12px;
456460
padding-top: calc(12px / 2);
457461
padding-bottom: calc(12px / 2);

0 commit comments

Comments
 (0)