fix: ui issues (#3738)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Qi
2023-08-15 02:48:18 +08:00
committed by GitHub
parent 52102ee792
commit 75a2bbdfac
23 changed files with 125 additions and 138 deletions

View File

@@ -233,7 +233,7 @@ export const Export = ({
return (
<Menu
width={248}
trigger="click"
trigger="hover"
placement="right-start"
content={
<>

View File

@@ -57,7 +57,7 @@ export const settingRow = style({
});
globalStyle(`${settingRow} .left-col`, {
flexShrink: 0,
flex: 1,
maxWidth: '100%',
});
globalStyle(`${settingRow}.two-col .left-col`, {
@@ -74,7 +74,7 @@ globalStyle(`${settingRow} .desc`, {
color: 'var(--affine-text-secondary-color)',
});
globalStyle(`${settingRow} .right-col`, {
flexGrow: 1,
width: '250px',
display: 'flex',
justifyContent: 'flex-end',
paddingLeft: '15px',

View File

@@ -8,27 +8,22 @@ import { type CSSProperties, forwardRef } from 'react';
import * as styles from './styles.css';
export const RadioButton = forwardRef<
HTMLButtonElement,
RadioGroupItemProps & { bold?: boolean }
>(({ children, bold, className, ...props }, ref) => {
return (
<RadioGroup.Item
ref={ref}
{...props}
className={clsx(styles.radioButton, className)}
>
<span className={clsx(styles.radioUncheckedButton, { bold })}>
{children}
</span>
<RadioGroup.Indicator
className={clsx(styles.radioButtonContent, { bold })}
export const RadioButton = forwardRef<HTMLButtonElement, RadioGroupItemProps>(
({ children, className, ...props }, ref) => {
return (
<RadioGroup.Item
ref={ref}
{...props}
className={clsx(styles.radioButton, className)}
>
{children}
</RadioGroup.Indicator>
</RadioGroup.Item>
);
});
<span className={styles.radioUncheckedButton}>{children}</span>
<RadioGroup.Indicator className={styles.radioButtonContent}>
{children}
</RadioGroup.Indicator>
</RadioGroup.Item>
);
}
);
RadioButton.displayName = 'RadioButton';
export const RadioButtonGroup = forwardRef<

View File

@@ -55,6 +55,11 @@ export const dropdownIcon = style({
export const radioButton = style({
flexGrow: 1,
selectors: {
'&:not(:last-of-type)': {
marginRight: '4px',
},
},
});
export const radioButtonContent = style({
fontSize: 'var(--affine-font-xs)',
@@ -66,6 +71,8 @@ export const radioButtonContent = style({
filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.1))',
whiteSpace: 'nowrap',
userSelect: 'none',
fontWeight: 600,
selectors: {
'&:hover': {
background: 'var(--affine-hover-color)',
@@ -73,9 +80,6 @@ export const radioButtonContent = style({
'&[data-state="checked"]': {
background: 'var(--affine-white)',
},
'&.bold': {
fontWeight: 600,
},
},
});

View File

@@ -6,7 +6,7 @@ export const MenuTrigger = forwardRef<HTMLButtonElement, ButtonProps>(
({ children, ...props }, ref) => {
return (
<Button
type="plain"
// type="plain"
ref={ref}
icon={<ArrowDownSmallIcon />}
iconPosition="end"

View File

@@ -13,6 +13,7 @@ export const StyledMenuWrapper = styled(StyledPopperContainer, {
return {
width,
height,
minWidth: '200px',
background: 'var(--affine-white)',
padding: '8px 4px',
fontSize: '14px',
@@ -63,7 +64,7 @@ export const StyledMenuItem = styled('button')<{
width: '100%',
borderRadius: '5px',
padding: '0 14px',
fontSize: 'var(--affine-font-base)',
fontSize: 'var(--affine-font-sm)',
height: '32px',
...displayFlex('flex-start', 'center'),
cursor: isDir ? 'pointer' : '',

View File

@@ -60,4 +60,5 @@ export type PopperProps = {
popperHandlerRef?: Ref<PopperHandler>;
onClickAway?: () => void;
triggerContainerStyle?: CSSProperties;
} & Omit<PopperUnstyledProps, 'open' | 'content'>;

View File

@@ -36,6 +36,7 @@ export const Popper = ({
onClickAway,
onPointerEnter,
onPointerLeave,
triggerContainerStyle = {},
...popperProps
}: PopperProps) => {
const [anchorEl, setAnchorEl] = useState<VirtualElement>();
@@ -111,7 +112,7 @@ export const Popper = ({
}
}}
>
<Container>
<Container style={triggerContainerStyle}>
{cloneElement(children, {
ref: (dom: HTMLDivElement) => setAnchorEl(dom),
onClick: (e: MouseEvent) => {

View File

@@ -14,7 +14,7 @@ export const switchStyle = style({
position: 'relative',
width: '46px',
height: '26px',
background: 'var(--affine-toggle-disable-background-color)',
background: 'var(--affine-icon-color)',
borderRadius: '37px',
transition: '200ms all',
border: '1px solid var(--affine-black-10)',