Skip to content

Commit

Permalink
Merge pull request #2136 from habx/fix/TabSelectOptionFocus
Browse files Browse the repository at this point in the history
APP-25425: fix add `fullWidth` prop
  • Loading branch information
habx-auto-merge[bot] authored Nov 26, 2021
2 parents 811dc18 + 365d27d commit e6ecb60
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/TabSelect/TabSelect.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ import { TabProps } from '../Tab/Tab.interface'

export interface TabSelectProps
extends React.HTMLAttributes<HTMLDivElement>,
Pick<TabProps, 'large' | 'small'> {}
Pick<TabProps, 'large' | 'small'> {
fullWidth?: boolean
}
3 changes: 3 additions & 0 deletions src/TabSelect/TabSelect.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import styled from 'styled-components'
export const TabSelectContainer = styled.div`
display: flex;
&[data-fullWidth='true'] > * {
flex-grow: 1;
}
&[data-small='true'] > * {
--tab-horizontal-padding: 8px;
--tab-height: 24px;
Expand Down
9 changes: 8 additions & 1 deletion src/TabSelect/TabSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ import { TabSelectContainer } from './TabSelect.style'

export const TabSelect = React.forwardRef<HTMLDivElement, TabSelectProps>(
(props, ref) => {
const { large = false, small = false, children, ...rest } = props
const {
large = false,
small = false,
fullWidth = false,
children,
...rest
} = props

return (
<TabSelectContainer
ref={ref}
data-large={large}
data-small={small}
data-fullWidth={fullWidth}
{...rest}
>
{children}
Expand Down
4 changes: 2 additions & 2 deletions src/TabSelect/TabSelectOption/TabSelectOption.style.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import styled from 'styled-components'

import { zIndex } from '../../_internal/theme/zIndex'
import { Tab } from '../../Tab'

export const TabSelectOptionContainer = styled(Tab)`
--tab-border-width: 0;
flex-grow: 1;
border: 1px solid var(--tab-border-color);
&:not(:first-child) {
border-left: none;
}
&:focus:not(:active) {
z-index: 100;
z-index: ${zIndex.floatingButtons};
}
&:not(:first-child):not(:last-child) {
Expand Down

0 comments on commit e6ecb60

Please sign in to comment.