Skip to content

Commit

Permalink
FilteredSearch no longer accepts styled system props (#1559)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfuchs committed Nov 22, 2021
1 parent a3bc921 commit b745047
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-days-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': major
---

FilteredSearch no longer accepts styled-system props. Please use the `sx` prop to extend Primer component styling instead. See also https://primer.style/react/overriding-styles for information about `sx` and https://primer.style/react/system-props for context on the removal.
15 changes: 4 additions & 11 deletions docs/content/FilteredSearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,11 @@ The FilteredSearch component helps style a Dropdown and a TextInput side-by-side
</FilteredSearch>
```

## System props

<Note variant="warning">

System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.

</Note>

FilteredSearch gets `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.

## Component props

#### FilteredSearch.Children

FilteredSearch is expected to contain a [`Dropdown`](/Dropdown) followed by a [`TextInput`](/TextInput).
| Name | Type | Default | Description |
| :------- | :---------------- | :-----: | :------------------------------------------------------------------------------------------------------- |
| children | | | FilteredSearch is expected to contain a [`Dropdown`](/Dropdown) followed by a [`TextInput`](/TextInput). |
| sx | SystemStyleObject | {} | Style to be applied to the component |
5 changes: 2 additions & 3 deletions src/FilteredSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import styled from 'styled-components'
import {COMMON, get, SystemCommonProps} from './constants'
import {get} from './constants'
import sx, {SxProp} from './sx'
import {ComponentProps} from './utils/types'

const FilteredSearch = styled.div<SystemCommonProps & SxProp>`
${COMMON};
const FilteredSearch = styled.div<SxProp>`
display: flex;
align-items: stretch;
Expand Down
11 changes: 11 additions & 0 deletions src/__tests__/FilteredSearch.types.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'
import FilteredSearch from '../FilteredSearch'

export function shouldAcceptCallWithNoProps() {
return <FilteredSearch />
}

export function shouldNotAcceptSystemProps() {
// @ts-expect-error system props should not be accepted
return <FilteredSearch backgroundColor="rosybrown" />
}

0 comments on commit b745047

Please sign in to comment.