Skip to content

Commit

Permalink
fix: fix minor visual issue with tag search facet text cropping desce…
Browse files Browse the repository at this point in the history
…nders
  • Loading branch information
robinpyon committed Feb 15, 2021
1 parent b457fd6 commit 0bd0249
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
20 changes: 9 additions & 11 deletions src/components/PickedBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {hues} from '@sanity/color'
import {Button, Flex, Label} from '@sanity/ui'
import {Box, Button, Flex, Label} from '@sanity/ui'
import pluralize from 'pluralize'
import React, {FC} from 'react'
import {useDispatch} from 'react-redux'
Expand Down Expand Up @@ -39,35 +39,33 @@ const PickedBar: FC = () => {
}}
>
<Flex align="center">
<Label
size={0}
style={{
color: 'inherit'
}}
>
<Label size={0} style={{color: 'inherit'}}>
{assetsPicked.length} {pluralize('asset', assetsPicked.length)} selected
</Label>

{/* Deselect button */}
<Flex marginLeft={4} marginRight={3}>
<Flex marginLeft={4} marginRight={0}>
<Button
mode="bleed"
onClick={handlePickClear}
style={{background: 'none', boxShadow: 'none'}}
>
<Label size={0}>Deselect</Label>
<Box padding={2}>
<Label size={0}>Deselect</Label>
</Box>
</Button>
</Flex>

{/* Delete button */}
<Button
fontSize={1}
mode="bleed"
onClick={handleDeletePicked}
style={{background: 'none', boxShadow: 'none'}}
tone="critical"
>
<Label size={0}>Delete</Label>
<Box padding={2}>
<Label size={0}>Delete</Label>
</Box>
</Button>
</Flex>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = {
facet: SearchFacetInputSearchableProps
}

const SearchFacetSearchable: FC<Props> = (props: Props) => {
const SearchFacetTags: FC<Props> = (props: Props) => {
const {facet} = props

// Redux
Expand Down Expand Up @@ -105,4 +105,4 @@ const SearchFacetSearchable: FC<Props> = (props: Props) => {
)
}

export default SearchFacetSearchable
export default SearchFacetTags
4 changes: 2 additions & 2 deletions src/components/SearchFacets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from 'styled-components'

import useTypedSelector from '../../hooks/useTypedSelector'
import SearchFacetNumber from '../SearchFacetNumber'
import SearchFacetSearchable from '../SearchFacetSearchable'
import SearchFacetTags from '../SearchFacetTags'
import SearchFacetSelect from '../SearchFacetSelect'
import SearchFacetString from '../SearchFacetString'

Expand All @@ -30,7 +30,7 @@ const SearchFacets: FC<Props> = (props: Props) => {
}

if (facet.type === 'searchable') {
return <SearchFacetSearchable facet={facet} key={facet.name} />
return <SearchFacetTags facet={facet} key={facet.name} />
}

if (facet.type === 'select') {
Expand Down
9 changes: 8 additions & 1 deletion src/styled/react-select/single.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ const SingleValue = (props: any) => {
return (
<components.SingleValue {...props}>
<Box paddingLeft={2}>
<Text size={1} style={{color: 'inherit'}} textOverflow="ellipsis">
<Text
size={1}
style={{
color: 'inherit',
lineHeight: '2em' // HACK: prevent text descenders from cropping
}}
textOverflow="ellipsis"
>
{props.children}
</Text>
</Box>
Expand Down

0 comments on commit 0bd0249

Please sign in to comment.