Skip to content

Commit 3a06c11

Browse files
committed
fix: plugin tag select styles
1 parent e7d461b commit 3a06c11

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

src/Shared/Components/Plugin/PluginTagSelect.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { useCallback, useMemo, useState } from 'react'
22
import ReactSelect, { MenuListProps } from 'react-select'
33
import { Option, OptionType } from '../../../Common'
4-
import { commonSelectStyles, LoadingIndicator, MenuListWithApplyButton } from '../ReactSelect'
4+
import { LoadingIndicator, MenuListWithApplyButton } from '../ReactSelect'
55
import { GenericSectionErrorState } from '../GenericSectionErrorState'
66
import { PluginTagSelectProps } from './types'
7-
import { PluginTagSelectValueContainer } from './utils'
7+
import { PluginTagSelectValueContainer, pluginTagSelectStyles } from './utils'
88

99
const PluginTagSelect = ({
1010
availableTags,
@@ -50,10 +50,9 @@ const PluginTagSelect = ({
5050
return <MenuListWithApplyButton {...props} handleApplyFilter={handleApplyFilters} />
5151
}, [])
5252

53-
// TODO: Look if should close menu on apply
5453
return (
5554
<ReactSelect
56-
styles={commonSelectStyles}
55+
styles={pluginTagSelectStyles}
5756
options={tagOptions}
5857
isMulti
5958
value={localSelectedOptions}

src/Shared/Components/Plugin/utils.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ReactComponent as ICSearch } from '../../../Assets/Icon/ic-search.svg'
55
import { ReactComponent as ICFilter } from '../../../Assets/Icon/ic-filter.svg'
66
import { ReactComponent as ICFilterApplied } from '../../../Assets/Icon/ic-filter-applied.svg'
77
import { OptionType } from '../../../Common'
8+
import { commonSelectStyles } from '../ReactSelect'
89

910
const parseMinimalPluginVersionsDTO = (
1011
pluginVersionData: ParentPluginDTO['pluginVersions']['minimalPluginVersionData'],
@@ -117,3 +118,23 @@ export const PluginTagSelectValueContainer = (props: ValueContainerProps<OptionT
117118
</components.ValueContainer>
118119
)
119120
}
121+
122+
// TODO: Should it be in constants?
123+
export const pluginTagSelectStyles = {
124+
...commonSelectStyles,
125+
option: (base, state) => ({
126+
...base,
127+
height: '36px',
128+
padding: '8px 12px',
129+
backgroundColor: state.isFocused ? 'var(--N100)' : 'white',
130+
color: 'var(--N900)',
131+
cursor: 'pointer',
132+
overflow: 'hidden',
133+
textOverflow: 'ellipsis',
134+
whiteSpace: 'nowrap',
135+
136+
':active': {
137+
backgroundColor: 'var(--N100)',
138+
},
139+
}),
140+
}

src/Shared/Components/ReactSelect/utils.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,17 @@ export const MenuListWithApplyButton = ({
191191
}: MenuListProps & { handleApplyFilter: () => void }) => (
192192
<>
193193
<components.MenuList {...props} />
194-
<div className="p-8 dc__position-sticky dc__bottom-0 dc__border-top-n1 bcn-0 dc__bottom-radius-4">
195-
<button
196-
type="button"
197-
className="dc__unset-button-styles w-100 br-4 h-28 flex bcb-5 cn-0 fw-6 lh-28 fs-12 h-28 br-4 pt-5 pr-12 pb-5 pl-12"
198-
onClick={handleApplyFilter}
199-
aria-label="Apply filters"
200-
>
201-
Apply
202-
</button>
203-
</div>
194+
{props.selectProps.options.length > 0 && (
195+
<div className="p-8 dc__position-sticky dc__bottom-0 dc__border-top-n1 bcn-0 dc__bottom-radius-4">
196+
<button
197+
type="button"
198+
className="dc__unset-button-styles w-100 br-4 h-28 flex bcb-5 cn-0 fw-6 lh-28 fs-12 h-28 br-4 pt-5 pr-12 pb-5 pl-12"
199+
onClick={handleApplyFilter}
200+
aria-label="Apply filters"
201+
>
202+
Apply
203+
</button>
204+
</div>
205+
)}
204206
</>
205207
)

0 commit comments

Comments
 (0)