diff --git a/.vscode/settings.json b/.vscode/settings.json index 9a1b58f9..a66ce196 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,6 @@ "git.branchProtection": [ "master" ], - "git.branchProtectionPrompt": "alwaysCommitToNewBranch" + "git.branchProtectionPrompt": "alwaysCommitToNewBranch", + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/src/components/Clickable/Button.tsx b/src/components/Clickable/Button.tsx index b0662bc8..9719033a 100644 --- a/src/components/Clickable/Button.tsx +++ b/src/components/Clickable/Button.tsx @@ -1,19 +1,30 @@ -import {Box, SxProps, Theme, Typography, TypographyProps} from '@mui/material' -import {ButtonHTMLAttributes, FC, ReactNode} from 'react' +import {Box, Stack, SxProps, Theme, Typography, TypographyProps} from '@mui/material' +import {ButtonHTMLAttributes, FC, MouseEventHandler, ReactNode} from 'react' -import {buttonTextSx, getButtonWrapperSx} from './buttonStyles' +import {buttonInnerSx, getButtonWrapperSx} from './buttonStyles' type ButtonProps = { - onClick?: () => void + onClick?: MouseEventHandler disabled?: boolean - children: ReactNode + children?: ReactNode + endElement?: ReactNode variant?: TypographyProps['variant'] invertColors?: boolean sx?: SxProps textSx?: SxProps } & Pick, 'type'> -export const Button: FC = ({children, onClick, disabled, type, variant, invertColors, sx, textSx}) => { +export const Button: FC = ({ + children, + endElement, + onClick, + disabled, + type, + variant, + invertColors, + sx, + textSx, +}) => { return ( // tento wrapper je tu kvoli lepsej kontrole paddingov atd. = ({children, onClick, disabled, type, vari ...sx, }} > - - {children} - + + {children} + + {endElement} + ) } diff --git a/src/components/Clickable/Link.tsx b/src/components/Clickable/Link.tsx index 398b8c66..f9daaf27 100644 --- a/src/components/Clickable/Link.tsx +++ b/src/components/Clickable/Link.tsx @@ -2,7 +2,7 @@ import {Box, SxProps, Theme, Typography, TypographyProps} from '@mui/material' import NextLink from 'next/link' import {ComponentProps, FC, ReactNode} from 'react' -import {buttonTextSx, getButtonWrapperSx} from './buttonStyles' +import {buttonInnerSx, getButtonWrapperSx} from './buttonStyles' type LinkProps = { href?: string @@ -16,22 +16,32 @@ type LinkProps = { } & Pick, 'target'> export const Link: FC = ({children, href, disabled, target, variant, invertColors, active, sx, textSx}) => { - // https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link - return disabled ? ( - - {children} - - ) : ( + if (disabled) { + return ( + + {/* https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link */} + + {children} + + + ) + } + + return ( // tento wrapper je tu kvoli lepsej kontrole paddingov atd. = ({children, href, disabled, target, variant, diff --git a/src/components/Clickable/buttonStyles.ts b/src/components/Clickable/buttonStyles.ts index f6fa44ed..212ebad4 100644 --- a/src/components/Clickable/buttonStyles.ts +++ b/src/components/Clickable/buttonStyles.ts @@ -12,7 +12,7 @@ export const getButtonWrapperSx = ({ const invert = !!invertColors !== !!active return { - display: 'flex', + display: 'inline-flex', cursor: disabled ? 'default' : 'pointer', // reset default