Skip to content

Commit

Permalink
fix(css): active, focus state in dynamic tabs select control
Browse files Browse the repository at this point in the history
  • Loading branch information
Elessar1802 committed Jan 17, 2025
1 parent da8df00 commit 95ac8aa
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions src/components/common/DynamicTabs/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,27 @@
*/

import { Dayjs } from 'dayjs'
import { StylesConfig } from 'react-select'
import { DynamicTabType } from '@devtron-labs/devtron-fe-common-lib'
import { MARK_AS_STALE_DATA_CUT_OFF_MINS } from '../../ResourceBrowser/Constants'
import { DynamicTabsVariantType } from './types'

export const COMMON_TABS_SELECT_STYLES = {
control: (base) => ({
export const COMMON_TABS_SELECT_STYLES: StylesConfig = {
control: (base, state) => ({
...base,
borderRadius: '4px 4px 0 0',
borderBottom: 'none',
boxShadow: 'none',
cursor: 'text',
backgroundColor: 'var(--bg-secondary)',
border: '1px solid var(--N200)',
'&:hover': {
borderColor: state.isDisabled ? 'var(--N200)' : 'var(--N300)',
},
'&:focus, &:focus-within': {
borderColor: state.isDisabled ? 'var(--N200)' : 'var(--B500)',
outline: 'none',
},
}),
valueContainer: (base) => ({
...base,
Expand Down Expand Up @@ -61,14 +69,29 @@ export const COMMON_TABS_SELECT_STYLES = {
...base,
color: 'var(--N900)',
}),
option: (base, state) => ({
...base,
backgroundColor: state.isFocused ? 'var(--N100)' : 'var(--bg-primary)',
color: 'var(--N900)',
padding: '8px 12px',
option: (_, state) => ({
display: 'flex',
gap: '6px',
alignItems: 'center',
gap: '6px',
color: 'var(--N900)',
padding: '6px 8px',
cursor: 'pointer',
fontSize: '13px',
lineHeight: '20px',
fontWeight: 400,

':active': {
backgroundColor: 'var(--N100)',
},

':hover': {
backgroundColor: 'var(--bg-secondary)',
},

...(state.isDisabled && {
cursor: 'not-allowed',
opacity: 0.5,
}),
}),
}

Expand Down

0 comments on commit 95ac8aa

Please sign in to comment.