-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(rebase): update filters files * chore(filters chip): remove local dev tag from Filters story so that reviewers can see component in preview storybook * chore(rebase): update filters files * fix(chip styles): disabled text color now colorNeutral40 * chore(rebase): update filters files
- Loading branch information
1 parent
e7df60b
commit 73f1f8e
Showing
4 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
8 changes: 3 additions & 5 deletions
8
packages/components/filters/src/filter-menu/chip/chip.spec.tsx
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 |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import { screen, render } from '../../../../../../test/test-utils'; | ||
import Chip from './chip'; | ||
|
||
/** | ||
* THIS IS A PLACEHOLDER, PLEASE UPDATE IT | ||
*/ | ||
describe('FilterMenu Chip', () => { | ||
it('should render the chip', async () => { | ||
await render(<Chip />); | ||
await screen.findByText('chip'); | ||
await render(<Chip label="test" />); | ||
const chip = await screen.findByRole('listitem'); | ||
expect(chip.textContent).toEqual('test'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,5 +1,40 @@ | ||
function Chip() { | ||
return <div>chip</div>; | ||
import { type ReactNode } from 'react'; | ||
import { designTokens } from '@commercetools-uikit/design-system'; | ||
import { css } from '@emotion/react'; | ||
|
||
export type TFilterMenuChipProps = { | ||
isDisabled?: boolean; | ||
label: ReactNode; | ||
}; | ||
|
||
const chipStyles = css` | ||
font-size: ${designTokens.fontSize20}; | ||
font-weight: ${designTokens.fontWeight400}; | ||
line-height: ${designTokens.lineHeight20}; | ||
color: ${designTokens.colorPrimary20}; | ||
background-color: ${designTokens.colorPrimary95}; | ||
height: ${designTokens.spacing40}; | ||
padding: 0 ${designTokens.spacing20}; | ||
border-radius: calc( | ||
${designTokens.borderRadius20} - ${designTokens.borderRadius4} | ||
); | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
list-style: none; | ||
`; | ||
|
||
const disabledChipStyles = css` | ||
color: ${designTokens.colorNeutral40}; | ||
background-color: ${designTokens.colorNeutral90}; | ||
`; | ||
|
||
function Chip(props: TFilterMenuChipProps) { | ||
return ( | ||
<li css={[chipStyles, props.isDisabled && disabledChipStyles]}> | ||
{props.label} | ||
</li> | ||
); | ||
} | ||
|
||
export default Chip; |
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