mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
Base component fixes
This commit is contained in:
@@ -9,7 +9,32 @@ interface DatePickerProps extends MantineDatePickerProps {
|
|||||||
width?: number | string;
|
width?: number | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyledDatePicker = styled(MantineDatePicker)<DatePickerProps>``;
|
const StyledDatePicker = styled(MantineDatePicker)<DatePickerProps>`
|
||||||
|
& .mantine-DatePicker-input {
|
||||||
|
color: var(--input-fg);
|
||||||
|
background: var(--input-bg);
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: var(--input-placeholder-fg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& .mantine-DatePicker-icon {
|
||||||
|
color: var(--input-placeholder-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
& .mantine-DatePicker-required {
|
||||||
|
color: var(--secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
& .mantine-DatePicker-label {
|
||||||
|
font-family: var(--label-font-faimly);
|
||||||
|
}
|
||||||
|
|
||||||
|
& .mantine-DateRangePicker-disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export const DatePicker = ({ width, maxWidth, ...props }: DatePickerProps) => {
|
export const DatePicker = ({ width, maxWidth, ...props }: DatePickerProps) => {
|
||||||
return <StyledDatePicker withinPortal {...props} sx={{ maxWidth, width }} />;
|
return <StyledDatePicker withinPortal {...props} sx={{ maxWidth, width }} />;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ const StyledMenuDropdown = styled(MantineMenu.Dropdown)`
|
|||||||
background: var(--dropdown-menu-bg);
|
background: var(--dropdown-menu-bg);
|
||||||
border: var(--dropdown-menu-border);
|
border: var(--dropdown-menu-border);
|
||||||
border-radius: var(--dropdown-menu-border-radius);
|
border-radius: var(--dropdown-menu-border-radius);
|
||||||
|
filter: drop-shadow(0 0 5px rgb(0, 0, 0, 50%));
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledMenuDivider = styled(MantineMenu.Divider)`
|
const StyledMenuDivider = styled(MantineMenu.Divider)`
|
||||||
@@ -69,7 +70,15 @@ const StyledMenuDivider = styled(MantineMenu.Divider)`
|
|||||||
|
|
||||||
export const DropdownMenu = ({ children, ...props }: MenuProps) => {
|
export const DropdownMenu = ({ children, ...props }: MenuProps) => {
|
||||||
return (
|
return (
|
||||||
<StyledMenu withinPortal radius="sm" transition="scale" {...props}>
|
<StyledMenu
|
||||||
|
withinPortal
|
||||||
|
radius="sm"
|
||||||
|
styles={{
|
||||||
|
dropdown: { filter: 'drop-shadow(0 0 5px rgb(0, 0, 0, 50%))' },
|
||||||
|
}}
|
||||||
|
transition="scale"
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</StyledMenu>
|
</StyledMenu>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -80,6 +80,18 @@ const StyledNumberInput = styled(MantineNumberInput)<NumberInputProps>`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* & .mantine-NumberInput-rightSection {
|
||||||
|
color: var(--input-placeholder-fg);
|
||||||
|
background: var(--input-bg);
|
||||||
|
} */
|
||||||
|
|
||||||
|
& .mantine-NumberInput-controlUp {
|
||||||
|
svg {
|
||||||
|
color: white;
|
||||||
|
fill: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
& .mantine-Input-icon {
|
& .mantine-Input-icon {
|
||||||
color: var(--input-placeholder-fg);
|
color: var(--input-placeholder-fg);
|
||||||
}
|
}
|
||||||
@@ -146,7 +158,7 @@ const StyledFileInput = styled(MantineFileInput)<FileInputProps>`
|
|||||||
font-family: var(--label-font-faimly);
|
font-family: var(--label-font-faimly);
|
||||||
}
|
}
|
||||||
|
|
||||||
& .mantine-PasswordInput-disabled {
|
& .mantine-FileInput-disabled {
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -171,6 +183,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|||||||
return (
|
return (
|
||||||
<StyledNumberInput
|
<StyledNumberInput
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
hideControls
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
{...props}
|
{...props}
|
||||||
sx={{ maxWidth, width }}
|
sx={{ maxWidth, width }}
|
||||||
@@ -184,12 +197,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|||||||
export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
|
export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
|
||||||
({ children, width, maxWidth, ...props }: PasswordInputProps, ref) => {
|
({ children, width, maxWidth, ...props }: PasswordInputProps, ref) => {
|
||||||
return (
|
return (
|
||||||
<StyledPasswordInput
|
<StyledPasswordInput ref={ref} {...props} sx={{ maxWidth, width }}>
|
||||||
ref={ref}
|
|
||||||
spellCheck={false}
|
|
||||||
{...props}
|
|
||||||
sx={{ maxWidth, width }}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</StyledPasswordInput>
|
</StyledPasswordInput>
|
||||||
);
|
);
|
||||||
@@ -199,12 +207,7 @@ export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
|
|||||||
export const FileInput = forwardRef<HTMLButtonElement, FileInputProps>(
|
export const FileInput = forwardRef<HTMLButtonElement, FileInputProps>(
|
||||||
({ children, width, maxWidth, ...props }: FileInputProps, ref) => {
|
({ children, width, maxWidth, ...props }: FileInputProps, ref) => {
|
||||||
return (
|
return (
|
||||||
<StyledFileInput
|
<StyledFileInput ref={ref} {...props} sx={{ maxWidth, width }}>
|
||||||
ref={ref}
|
|
||||||
spellCheck={false}
|
|
||||||
{...props}
|
|
||||||
sx={{ maxWidth, width }}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</StyledFileInput>
|
</StyledFileInput>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,15 +15,20 @@ const StyledDropdown = styled(MantinePopover.Dropdown)<PopoverDropdownProps>`
|
|||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
font-family: var(--content-font-family);
|
font-family: var(--content-font-family);
|
||||||
background-color: var(--dropdown-menu-bg);
|
background-color: var(--dropdown-menu-bg);
|
||||||
|
|
||||||
& .mantine-Menu-itemIcon {
|
|
||||||
margin-right: 0.5rem;
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const Popover = ({ children, ...props }: PopoverProps) => {
|
export const Popover = ({ children, ...props }: PopoverProps) => {
|
||||||
return (
|
return (
|
||||||
<StyledPopover withArrow withinPortal {...props}>
|
<StyledPopover
|
||||||
|
withArrow
|
||||||
|
withinPortal
|
||||||
|
styles={{
|
||||||
|
dropdown: {
|
||||||
|
filter: 'drop-shadow(0 0 5px rgb(0, 0, 0, 50%))',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</StyledPopover>
|
</StyledPopover>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export const Select = ({ width, maxWidth, ...props }: SelectProps) => {
|
|||||||
styles={{
|
styles={{
|
||||||
dropdown: {
|
dropdown: {
|
||||||
background: 'var(--dropdown-menu-bg)',
|
background: 'var(--dropdown-menu-bg)',
|
||||||
|
filter: 'drop-shadow(0 0 5px rgb(0, 0, 0, 20%))',
|
||||||
},
|
},
|
||||||
input: {
|
input: {
|
||||||
background: 'var(--input-bg)',
|
background: 'var(--input-bg)',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { MouseEvent } from 'react';
|
import React, { MouseEvent } from 'react';
|
||||||
import { Group, UnstyledButtonProps } from '@mantine/core';
|
import { Group, UnstyledButtonProps } from '@mantine/core';
|
||||||
import { motion } from 'framer-motion';
|
import { motion, Variants } from 'framer-motion';
|
||||||
import {
|
import {
|
||||||
RiPlayFill,
|
RiPlayFill,
|
||||||
RiMore2Fill,
|
RiMore2Fill,
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
RiHeartLine,
|
RiHeartLine,
|
||||||
} from 'react-icons/ri';
|
} from 'react-icons/ri';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Button } from '@/renderer/components/button';
|
import { _Button } from '@/renderer/components/button';
|
||||||
import { DropdownMenu } from '@/renderer/components/dropdown-menu';
|
import { DropdownMenu } from '@/renderer/components/dropdown-menu';
|
||||||
import { LibraryItem, Play, PlayQueueAddOptions } from '@/renderer/types';
|
import { LibraryItem, Play, PlayQueueAddOptions } from '@/renderer/types';
|
||||||
|
|
||||||
@@ -33,6 +33,13 @@ const PlayButton = styled(motion.button)<PlayButtonType>`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const SecondaryButton = styled(motion(_Button))`
|
||||||
|
fill: white !important;
|
||||||
|
svg: {
|
||||||
|
fill: white !important;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const GridCardControlsContainer = styled.div`
|
const GridCardControlsContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -100,15 +107,30 @@ export const GridCardControls = ({
|
|||||||
itemType: LibraryItem;
|
itemType: LibraryItem;
|
||||||
playButtonBehavior: Play;
|
playButtonBehavior: Play;
|
||||||
}) => {
|
}) => {
|
||||||
|
const buttonVariants: Variants = {
|
||||||
|
hover: {
|
||||||
|
opacity: 1,
|
||||||
|
scale: 1.1,
|
||||||
|
},
|
||||||
|
initial: {
|
||||||
|
opacity: 0.6,
|
||||||
|
scale: 1,
|
||||||
|
},
|
||||||
|
pressed: {
|
||||||
|
scale: 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GridCardControlsContainer>
|
<GridCardControlsContainer>
|
||||||
<TopControls />
|
<TopControls />
|
||||||
<CenterControls animate={{ opacity: 1 }} initial={{ opacity: 0 }} />
|
<CenterControls animate={{ opacity: 1 }} initial={{ opacity: 0 }} />
|
||||||
<BottomControls>
|
<BottomControls>
|
||||||
<PlayButton
|
<PlayButton
|
||||||
animate={{ opacity: 0.6 }}
|
initial="initial"
|
||||||
whileHover={{ opacity: 1, scale: 1.1 }}
|
variants={buttonVariants}
|
||||||
whileTap={{ scale: 1 }}
|
whileHover="hover"
|
||||||
|
whileTap="pressed"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -124,7 +146,15 @@ export const GridCardControls = ({
|
|||||||
<RiPlayFill size={25} />
|
<RiPlayFill size={25} />
|
||||||
</PlayButton>
|
</PlayButton>
|
||||||
<Group spacing="xs">
|
<Group spacing="xs">
|
||||||
<Button disabled p={5} variant="subtle">
|
<SecondaryButton
|
||||||
|
disabled
|
||||||
|
p={5}
|
||||||
|
sx={{ svg: { fill: 'white !important' } }}
|
||||||
|
variant="subtle"
|
||||||
|
variants={buttonVariants}
|
||||||
|
whileHover="hover"
|
||||||
|
whileTap="pressed"
|
||||||
|
>
|
||||||
<FavoriteWrapper isFavorite={itemData?.isFavorite}>
|
<FavoriteWrapper isFavorite={itemData?.isFavorite}>
|
||||||
{itemData?.isFavorite ? (
|
{itemData?.isFavorite ? (
|
||||||
<RiHeartFill size={20} />
|
<RiHeartFill size={20} />
|
||||||
@@ -132,19 +162,24 @@ export const GridCardControls = ({
|
|||||||
<RiHeartLine color="white" size={20} />
|
<RiHeartLine color="white" size={20} />
|
||||||
)}
|
)}
|
||||||
</FavoriteWrapper>
|
</FavoriteWrapper>
|
||||||
</Button>
|
</SecondaryButton>
|
||||||
<DropdownMenu withinPortal position="bottom-start">
|
<DropdownMenu withinPortal position="bottom-start">
|
||||||
<DropdownMenu.Target>
|
<DropdownMenu.Target>
|
||||||
<Button
|
<SecondaryButton
|
||||||
|
initial="initial"
|
||||||
p={5}
|
p={5}
|
||||||
|
sx={{ svg: { fill: 'white !important' } }}
|
||||||
variant="subtle"
|
variant="subtle"
|
||||||
|
variants={buttonVariants}
|
||||||
|
whileHover="hover"
|
||||||
|
whileTap="pressed"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<RiMore2Fill color="white" size={20} />
|
<RiMore2Fill color="white" size={20} />
|
||||||
</Button>
|
</SecondaryButton>
|
||||||
</DropdownMenu.Target>
|
</DropdownMenu.Target>
|
||||||
<DropdownMenu.Dropdown>
|
<DropdownMenu.Dropdown>
|
||||||
{PLAY_TYPES.filter(
|
{PLAY_TYPES.filter(
|
||||||
|
|||||||
Reference in New Issue
Block a user