Skip to content

Commit ae778b8

Browse files
Update arrow btn styles
1 parent 0f802ff commit ae778b8

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

src/UnderlineNav2/UnderlineNavArrowButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const ArrowButton = ({
5656
aria-label={`Scroll ${ariaLabel} navigation ${type}`}
5757
onClick={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => onScrollWithButton(e, direction)}
5858
icon={type === 'left' ? ChevronLeftIcon : ChevronRightIcon}
59-
sx={getArrowBtnStyles(theme, type)}
59+
sx={getArrowBtnStyles(theme)}
6060
aria-disabled={!show}
6161
/>
6262
</Box>

src/UnderlineNav2/styles.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const counterStyles = {
3232

3333
export const getNavStyles = (theme?: Theme, props?: Partial<Pick<UnderlineNavProps, 'align'>>) => ({
3434
display: 'flex',
35-
paddingX: 2,
3635
justifyContent: props?.align === 'right' ? 'flex-end' : 'flex-start',
3736
borderBottom: '1px solid',
3837
borderBottomColor: `${theme?.colors.border.muted}`,
@@ -44,10 +43,12 @@ export const getNavStyles = (theme?: Theme, props?: Partial<Pick<UnderlineNavPro
4443
export const ulStyles = {
4544
display: 'flex',
4645
listStyle: 'none',
47-
padding: '0',
46+
paddingY: 0,
47+
paddingX: 3,
4848
margin: '0',
4949
marginBottom: '-1px',
50-
alignItems: 'center'
50+
alignItems: 'center',
51+
gap: 2
5152
}
5253

5354
export const getDividerStyle = (theme?: Theme) => ({
@@ -82,6 +83,8 @@ export const btnWrapperStyles = (
8283
bottom: 0,
8384
left: direction === 'left' ? 0 : 'auto',
8485
right: direction === 'right' ? 0 : 'auto',
86+
// Min touch target size
87+
width: '44px',
8588
alignItems: 'center',
8689
background: show
8790
? `linear-gradient(to ${direction} ,#fff0, ${theme?.colors.canvas.default} 14px, ${theme?.colors.canvas.default} 100%)`
@@ -90,33 +93,28 @@ export const btnWrapperStyles = (
9093
display: `${display}`
9194
})
9295

93-
export const getArrowBtnStyles = (theme?: Theme, direction = 'left') => ({
94-
fontWeight: 'normal',
96+
export const getArrowBtnStyles = (theme?: Theme) => ({
9597
boxShadow: 'none',
96-
margin: 0,
9798
border: 0,
98-
borderRadius: 2,
99-
paddingX: '14px',
100-
paddingY: 0,
10199
background: 'transparent',
102-
height: '60%',
103-
100+
width: '100%',
101+
height: '100%',
102+
// to reset the hover styles of the button
104103
'&:hover:not([disabled]), &:focus-visible': {
105-
background: theme?.colors.canvas.default
104+
background: 'transparent'
106105
},
106+
// To reset global focus styles because it doesn't support safari right now.
107107
'&:focus:not(:disabled)': {
108108
outline: 0,
109-
boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`,
110-
background: `linear-gradient(to ${direction} ,#fff0, ${theme?.colors.canvas.default} 14px, ${theme?.colors.canvas.default} 100%)`
109+
boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`
111110
},
112111
// where focus-visible is supported, remove the focus box-shadow
113112
'&:not(:focus-visible)': {
114-
boxShadow: 'none',
115-
background: `linear-gradient(to ${direction} ,#fff0, ${theme?.colors.canvas.default} 14px, ${theme?.colors.canvas.default} 100%)`
113+
boxShadow: 'none'
116114
},
117115
'&:focus-visible:not(:disabled)': {
118-
boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`,
119-
background: `linear-gradient(to ${direction} ,#fff0, ${theme?.colors.canvas.default} 14px, ${theme?.colors.canvas.default} 100%)`
116+
outline: 0,
117+
boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`
120118
}
121119
})
122120

@@ -131,7 +129,6 @@ export const getLinkStyles = (
131129
color: 'fg.default',
132130
textAlign: 'center',
133131
textDecoration: 'none',
134-
paddingX: 1,
135132
...(props?.variant === 'small' ? smallVariantLinkStyles : defaultVariantLinkStyles),
136133
'@media (hover:hover)': {
137134
'&:hover > div[data-component="wrapper"] ': {
@@ -166,7 +163,7 @@ export const getLinkStyles = (
166163
position: 'absolute',
167164
right: '50%',
168165
bottom: 0,
169-
width: `calc(100% - 8px)`,
166+
width: '100%',
170167
height: 2,
171168
content: '""',
172169
bg: selectedLink === ref ? theme?.colors.primer.border.active : 'transparent',

0 commit comments

Comments
 (0)