-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for SelectPanel Filter width (#1742)
* Fix for SelectPanel Filter width * Lint issues * Create shaggy-hounds-decide.md
- Loading branch information
Showing
5 changed files
with
85 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Fix for SelectPanel Filter width |
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,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'}} | ||
/> | ||
</> | ||
) | ||
} |
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
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