OPS-249: Add text color for buttons (#15)

This commit is contained in:
Rinat Arsaev 2023-02-02 15:03:12 +06:00 committed by GitHub
parent 7dd9eb2c3d
commit 98964ee777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -16,6 +16,7 @@ interface Props extends React.ComponentProps<typeof ButtonUnstyled> {
size?: "small" | "medium" | "large";
svgColoredParams?: SvgColoredParam[];
disabled?: boolean;
textColor?: string;
}
function getColoredSvgCss(params: SvgColoredParam[] = [], color: string) {
@ -28,7 +29,7 @@ const StyledButton = styled(ButtonUnstyled)<{
({
theme,
color,
styled: { variant, size, svgColoredParams, hasText, disabled },
styled: { variant, size, svgColoredParams, hasText, disabled, textColor },
}) => {
const buttonSizes = {
large: 6,
@ -51,7 +52,7 @@ const StyledButton = styled(ButtonUnstyled)<{
if (disabled) {
iconColor = theme?.palette?.grey?.[500];
} else {
if (!hasText && variant === "contained")
if (textColor)
hoverIconColor =
activeIconColor =
iconColor =
@ -167,6 +168,7 @@ export const Button: React.FC<Props> = ({
size,
svgColoredParams,
disabled,
textColor,
...props
}) => {
const { navigate } = useI18next();
@ -187,6 +189,7 @@ export const Button: React.FC<Props> = ({
svgColoredParams: svgColoredParams || ["fill"],
hasText: !!children,
disabled: !!disabled,
textColor,
}}
>
<Stack

View File

@ -109,6 +109,7 @@ export const Carousel: React.FC<Props> = ({ images, width }) => {
}}
endIcon={<Repeat />}
size="large"
textColor="primary"
/>
)}
</Box>
@ -122,6 +123,7 @@ export const Carousel: React.FC<Props> = ({ images, width }) => {
}}
endIcon={<ArrowLeft />}
size="large"
textColor="primary"
/>
)}
<Button
@ -133,6 +135,7 @@ export const Carousel: React.FC<Props> = ({ images, width }) => {
endIcon={<ArrowRight />}
size="large"
disabled={!(active > -images.length + 1)}
textColor="primary"
/>
</Stack>
</Stack>