Update base components

This commit is contained in:
jeffvli
2022-11-03 03:19:15 -07:00
parent e9142ffaa5
commit be05c1df79
6 changed files with 88 additions and 20 deletions
+27 -3
View File
@@ -45,8 +45,32 @@ const StyledButton = styled(MantineButton)<StyledButtonProps>`
}}; }};
&:disabled { &:disabled {
background-color: transparent; color: ${(props) => {
opacity: 0.8; switch (props.variant) {
case 'default':
return 'var(--btn-default-fg)';
case 'filled':
return 'var(--btn-primary-fg)';
case 'subtle':
return 'var(--btn-subtle-fg)';
default:
return '';
}
}};
background-color: ${(props) => {
switch (props.variant) {
case 'default':
return 'var(--btn-default-bg)';
case 'filled':
return 'var(--btn-primary-bg)';
case 'subtle':
return 'var(--btn-subtle-bg)';
default:
return '';
}
}};
opacity: 0.4;
} }
&:hover { &:hover {
@@ -93,7 +117,7 @@ export const _Button = forwardRef<HTMLButtonElement, ButtonProps>(
({ children, tooltip, ...props }: ButtonProps, ref) => { ({ children, tooltip, ...props }: ButtonProps, ref) => {
if (tooltip) { if (tooltip) {
return ( return (
<Tooltip {...tooltip}> <Tooltip withinPortal {...tooltip}>
<StyledButton ref={ref} {...props}> <StyledButton ref={ref} {...props}>
{children} {children}
</StyledButton> </StyledButton>
@@ -5,15 +5,17 @@ import {
} from '@mantine/dates'; } from '@mantine/dates';
interface DatePickerProps extends MantineDatePickerProps { interface DatePickerProps extends MantineDatePickerProps {
maxWidth?: number | string;
width?: number | string; width?: number | string;
} }
const StyledDatePicker = styled(MantineDatePicker)<DatePickerProps>``; const StyledDatePicker = styled(MantineDatePicker)<DatePickerProps>``;
export const DatePicker = ({ width, ...props }: DatePickerProps) => { export const DatePicker = ({ width, maxWidth, ...props }: DatePickerProps) => {
return <StyledDatePicker {...props} sx={{ width }} />; return <StyledDatePicker {...props} sx={{ maxWidth, width }} />;
}; };
DatePicker.defaultProps = { DatePicker.defaultProps = {
maxWidth: undefined,
width: undefined, width: undefined,
}; };
@@ -30,6 +30,10 @@ const StyledMenuItem = styled(MantineMenu.Item)`
& .mantine-Menu-itemIcon { & .mantine-Menu-itemIcon {
margin-right: 0.5rem; margin-right: 0.5rem;
} }
& .mantine-Menu-itemRightSection {
margin-left: 2rem !important;
}
`; `;
const StyledMenuDropdown = styled(MantineMenu.Dropdown)` const StyledMenuDropdown = styled(MantineMenu.Dropdown)`
+1
View File
@@ -13,3 +13,4 @@ export * from './popover';
export * from './select'; export * from './select';
export * from './date-picker'; export * from './date-picker';
export * from './scroll-area'; export * from './scroll-area';
export * from './paper';
+31 -8
View File
@@ -13,21 +13,25 @@ import {
interface TextInputProps extends MantineTextInputProps { interface TextInputProps extends MantineTextInputProps {
children?: React.ReactNode; children?: React.ReactNode;
maxWidth?: number | string;
width?: number | string; width?: number | string;
} }
interface NumberInputProps extends MantineNumberInputProps { interface NumberInputProps extends MantineNumberInputProps {
children?: React.ReactNode; children?: React.ReactNode;
maxWidth?: number | string;
width?: number | string; width?: number | string;
} }
interface PasswordInputProps extends MantinePasswordInputProps { interface PasswordInputProps extends MantinePasswordInputProps {
children?: React.ReactNode; children?: React.ReactNode;
maxWidth?: number | string;
width?: number | string; width?: number | string;
} }
interface FileInputProps extends MantineFileInputProps { interface FileInputProps extends MantineFileInputProps {
children?: React.ReactNode; children?: React.ReactNode;
maxWidth?: number | string;
width?: number | string; width?: number | string;
} }
@@ -140,9 +144,14 @@ const StyledFileInput = styled(MantineFileInput)<FileInputProps>`
`; `;
export const TextInput = forwardRef<HTMLInputElement, TextInputProps>( export const TextInput = forwardRef<HTMLInputElement, TextInputProps>(
({ children, width, ...props }: TextInputProps, ref) => { ({ children, width, maxWidth, ...props }: TextInputProps, ref) => {
return ( return (
<StyledTextInput ref={ref} spellCheck={false} {...props} sx={{ width }}> <StyledTextInput
ref={ref}
spellCheck={false}
{...props}
sx={{ maxWidth, width }}
>
{children} {children}
</StyledTextInput> </StyledTextInput>
); );
@@ -150,9 +159,14 @@ export const TextInput = forwardRef<HTMLInputElement, TextInputProps>(
); );
export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>( export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
({ children, width, ...props }: NumberInputProps, ref) => { ({ children, width, maxWidth, ...props }: NumberInputProps, ref) => {
return ( return (
<StyledNumberInput ref={ref} spellCheck={false} {...props} sx={{ width }}> <StyledNumberInput
ref={ref}
spellCheck={false}
{...props}
sx={{ maxWidth, width }}
>
{children} {children}
</StyledNumberInput> </StyledNumberInput>
); );
@@ -160,13 +174,13 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
); );
export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>( export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
({ children, width, ...props }: PasswordInputProps, ref) => { ({ children, width, maxWidth, ...props }: PasswordInputProps, ref) => {
return ( return (
<StyledPasswordInput <StyledPasswordInput
ref={ref} ref={ref}
spellCheck={false} spellCheck={false}
{...props} {...props}
sx={{ width }} sx={{ maxWidth, width }}
> >
{children} {children}
</StyledPasswordInput> </StyledPasswordInput>
@@ -175,9 +189,14 @@ export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
); );
export const FileInput = forwardRef<HTMLButtonElement, FileInputProps>( export const FileInput = forwardRef<HTMLButtonElement, FileInputProps>(
({ children, width, ...props }: FileInputProps, ref) => { ({ children, width, maxWidth, ...props }: FileInputProps, ref) => {
return ( return (
<StyledFileInput ref={ref} spellCheck={false} {...props} sx={{ width }}> <StyledFileInput
ref={ref}
spellCheck={false}
{...props}
sx={{ maxWidth, width }}
>
{children} {children}
</StyledFileInput> </StyledFileInput>
); );
@@ -186,20 +205,24 @@ export const FileInput = forwardRef<HTMLButtonElement, FileInputProps>(
TextInput.defaultProps = { TextInput.defaultProps = {
children: undefined, children: undefined,
maxWidth: undefined,
width: undefined, width: undefined,
}; };
NumberInput.defaultProps = { NumberInput.defaultProps = {
children: undefined, children: undefined,
maxWidth: undefined,
width: undefined, width: undefined,
}; };
PasswordInput.defaultProps = { PasswordInput.defaultProps = {
children: undefined, children: undefined,
maxWidth: undefined,
width: undefined, width: undefined,
}; };
FileInput.defaultProps = { FileInput.defaultProps = {
children: undefined, children: undefined,
maxWidth: undefined,
width: undefined, width: undefined,
}; };
+21 -7
View File
@@ -14,12 +14,13 @@
--main-bg: rgb(24, 24, 25); --main-bg: rgb(24, 24, 25);
--main-fg: rgb(193, 194, 187); --main-fg: rgb(193, 194, 187);
--main-fg-secondary: rgb(150, 150, 150);
--titlebar-fg: rgb(255, 255, 255); --titlebar-fg: rgb(255, 255, 255);
--titlebar-bg: rgb(29, 29, 29); --titlebar-bg: rgb(29, 29, 29);
--sidebar-bg: rgb(16, 16, 16); --sidebar-bg: rgb(16, 16, 16);
--sidebar-btn-color: #b3b3b3; --sidebar-btn-color: rgb(179, 179, 179);
--sidebar-btn-color-hover: #dddddd; --sidebar-btn-color-hover: #dddddd;
--sidebar-handle-bg: #4d4d4d; --sidebar-handle-bg: #4d4d4d;
@@ -52,7 +53,7 @@
--btn-subtle-bg: transparent; --btn-subtle-bg: transparent;
--btn-subtle-bg-hover: rgba(100, 100, 100, 0.5); --btn-subtle-bg-hover: rgba(100, 100, 100, 0.5);
--btn-subtle-fg: rgb(119, 126, 139); --btn-subtle-fg: rgb(150, 150, 150);
--btn-subtle-fg-hover: rgb(200, 200, 200); --btn-subtle-fg-hover: rgb(200, 200, 200);
--input-bg: rgb(37, 38, 43); --input-bg: rgb(37, 38, 43);
@@ -62,6 +63,10 @@
--dropdown-menu-bg: rgb(24, 24, 24); --dropdown-menu-bg: rgb(24, 24, 24);
--dropdown-menu-fg: rgb(193, 194, 197); --dropdown-menu-fg: rgb(193, 194, 197);
--switch-track-bg: rgb(50, 50, 50);
--switch-track-enabled-bg: var(--primary-color);
--switch-thumb-bg: rgb(255, 255, 255);
--toast-title-fg: rgb(255, 255, 255); --toast-title-fg: rgb(255, 255, 255);
--toast-description-fg: rgb(193, 194, 197); --toast-description-fg: rgb(193, 194, 197);
--toast-bg: rgb(16, 16, 16); --toast-bg: rgb(16, 16, 16);
@@ -69,12 +74,21 @@
--paper-bg: rgb(29, 29, 29); --paper-bg: rgb(29, 29, 29);
.ag-theme-alpine-dark { .ag-theme-alpine-dark {
--ag-borders: none; --ag-font-family: poppins;
--ag-background-color: #101010;
--ag-odd-row-background-color: #101010;
--ag-font-size: 12px; --ag-font-size: 12px;
--ag-foreground-color: #ffffff;
--ag-font-family: Poppins; --ag-borders: none;
--ag-border-color: rgb(50, 50, 50);
--ag-header-background-color: rgb(16, 16, 16);
--ag-header-foreground-color: rgb(179, 179, 179);
--ag-foreground-color: rgb(179, 179, 179);
--ag-background-color: rgb(24, 24, 25);
--ag-odd-row-background-color: rgb(24, 24, 25);
--ag-row-hover-color: rgba(100, 100, 100, 0.2);
--ag-selected-row-background-color: rgba(100, 100, 100, 0.4);
} }
.ag-header-cell-label { .ag-header-cell-label {