14d3866439
Closes #15728 ## Problem The `color` of `ButtonHotKeys` was set to `theme.border.color.blue` when the button accent was blue. This led to poor visibility of the hotkey. ## Solution The `color` is now set to `GRAY_SCALE_LIGHT.gray7` ## Screenshots ### Before <img width="278" height="54" alt="image" src="https://github.com/user-attachments/assets/7dd2c8a4-1230-4b57-9a1d-62564ab15337" /> <img width="280" height="52" alt="image" src="https://github.com/user-attachments/assets/21cc62fb-e1eb-47ce-925c-3658389d24d8" /> ### After <img width="274" height="54" alt="image" src="https://github.com/user-attachments/assets/cfbed222-a807-4af2-ab11-839ef5274186" /> <img width="275" height="52" alt="image" src="https://github.com/user-attachments/assets/602274d8-3af6-4de8-9504-2cb0fe30d5dc" /> --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
import styled from '@emotion/styled';
|
|
import {
|
|
type ButtonAccent,
|
|
type ButtonSize,
|
|
type ButtonVariant,
|
|
} from '@ui/input';
|
|
import { getOsShortcutSeparator } from '@ui/utilities';
|
|
|
|
const StyledSeparator = styled.div<{
|
|
buttonSize: ButtonSize;
|
|
accent: ButtonAccent;
|
|
}>`
|
|
background: ${({ theme, accent }) => {
|
|
switch (accent) {
|
|
case 'blue':
|
|
return theme.buttons.secondaryTextColor;
|
|
case 'danger':
|
|
return theme.border.color.danger;
|
|
default:
|
|
return theme.font.color.light;
|
|
}
|
|
}};
|
|
height: ${({ theme, buttonSize }) =>
|
|
theme.spacing(buttonSize === 'small' ? 2 : 4)};
|
|
margin: 0;
|
|
width: 1px;
|
|
`;
|
|
|
|
const StyledShortcutLabel = styled.div<{
|
|
variant: ButtonVariant;
|
|
accent: ButtonAccent;
|
|
}>`
|
|
color: ${({ theme, variant, accent }) => {
|
|
switch (accent) {
|
|
case 'blue':
|
|
return theme.buttons.secondaryTextColor;
|
|
case 'danger':
|
|
return variant === 'primary'
|
|
? theme.border.color.danger
|
|
: theme.color.red8;
|
|
default:
|
|
return theme.font.color.light;
|
|
}
|
|
}};
|
|
font-weight: ${({ theme }) => theme.font.weight.medium};
|
|
`;
|
|
|
|
export const ButtonHotkeys = ({
|
|
size,
|
|
accent,
|
|
variant,
|
|
hotkeys,
|
|
}: {
|
|
size: ButtonSize;
|
|
accent: ButtonAccent;
|
|
variant: ButtonVariant;
|
|
hotkeys: string[];
|
|
}) => (
|
|
<>
|
|
<StyledSeparator buttonSize={size} accent={accent} />
|
|
<StyledShortcutLabel variant={variant} accent={accent}>
|
|
{hotkeys.join(getOsShortcutSeparator())}
|
|
</StyledShortcutLabel>
|
|
</>
|
|
);
|