mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
replaced div with button
This commit is contained in:
parent
44bbc4cd4c
commit
40af254e5c
3 changed files with 19 additions and 16 deletions
|
@ -1,9 +1,7 @@
|
|||
import React, { FC, useCallback, useEffect, useRef } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { IEditorComponentProps } from '~/redux/node/types';
|
||||
import classNames from 'classnames';
|
||||
import { usePopper } from 'react-popper';
|
||||
import { Button } from '~/components/input/Button';
|
||||
|
||||
interface IProps extends IEditorComponentProps {}
|
||||
|
||||
|
@ -29,20 +27,19 @@ const EditorPublicSwitch: FC<IProps> = ({ data, setData }) => {
|
|||
useEffect(() => console.log(pop), [pop]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(styles.wrap, { [styles.promoted]: data.is_promoted })}
|
||||
onClick={onChange}
|
||||
>
|
||||
<div className={styles.tooltip} ref={tooltip}>
|
||||
{data.is_promoted
|
||||
<Button
|
||||
color={data.is_promoted ? 'primary' : 'secondary'}
|
||||
type="button"
|
||||
iconLeft={data.is_promoted ? 'waves' : 'lab'}
|
||||
size="giant"
|
||||
label={
|
||||
data.is_promoted
|
||||
? 'Доступно всем на главной странице'
|
||||
: 'Видно только сотрудникам в лаборатории'}
|
||||
</div>
|
||||
|
||||
<div className={styles.icon}>
|
||||
{data.is_promoted ? <Icon size={24} icon="waves" /> : <Icon size={24} icon="lab" />}
|
||||
</div>
|
||||
</div>
|
||||
: 'Видно только сотрудникам в лаборатории'
|
||||
}
|
||||
onClick={onChange}
|
||||
round
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ type IButtonProps = DetailedHTMLProps<
|
|||
stretchy?: boolean;
|
||||
iconOnly?: boolean;
|
||||
label?: string;
|
||||
round?: boolean;
|
||||
};
|
||||
|
||||
const Button: FC<IButtonProps> = memo(
|
||||
|
@ -48,6 +49,7 @@ const Button: FC<IButtonProps> = memo(
|
|||
iconOnly,
|
||||
label,
|
||||
ref,
|
||||
round,
|
||||
...props
|
||||
}) => {
|
||||
const tooltip = useRef<HTMLSpanElement | null>(null);
|
||||
|
@ -75,6 +77,7 @@ const Button: FC<IButtonProps> = memo(
|
|||
icon: ((iconLeft || iconRight) && !title && !children) || iconOnly,
|
||||
has_icon_left: !!iconLeft,
|
||||
has_icon_right: !!iconRight,
|
||||
round,
|
||||
}),
|
||||
...props,
|
||||
},
|
||||
|
|
|
@ -202,14 +202,17 @@
|
|||
.normal {
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.big {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.giant {
|
||||
height: 50px;
|
||||
padding: 0 15px;
|
||||
min-width: 50px;
|
||||
}
|
||||
|
||||
.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue