mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added flow display controls overlay
This commit is contained in:
parent
c8204a41a2
commit
5fef4bc804
14 changed files with 327 additions and 116 deletions
|
@ -1,16 +1,17 @@
|
|||
import React, { FC, useCallback } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import classNames from 'classnames';
|
||||
import { ButtonProps, DivProps } from '~/utils/types';
|
||||
|
||||
type ToggleColor = 'primary' | 'secondary' | 'lab' | 'danger';
|
||||
type ToggleColor = 'primary' | 'secondary' | 'lab' | 'danger' | 'white';
|
||||
|
||||
interface IProps {
|
||||
type IProps = Omit<ButtonProps, 'value' | 'color'> & {
|
||||
value?: boolean;
|
||||
handler?: (val: boolean) => void;
|
||||
color?: ToggleColor;
|
||||
}
|
||||
};
|
||||
|
||||
const Toggle: FC<IProps> = ({ value, handler, color = 'primary' }) => {
|
||||
const Toggle: FC<IProps> = ({ value, handler, color = 'primary', ...rest }) => {
|
||||
const onClick = useCallback(() => {
|
||||
if (!handler) {
|
||||
return;
|
||||
|
@ -21,8 +22,14 @@ const Toggle: FC<IProps> = ({ value, handler, color = 'primary' }) => {
|
|||
|
||||
return (
|
||||
<button
|
||||
{...rest}
|
||||
type="button"
|
||||
className={classNames(styles.toggle, { [styles.active]: value }, styles[color])}
|
||||
className={classNames(
|
||||
styles.toggle,
|
||||
{ [styles.active]: value },
|
||||
styles[color],
|
||||
rest.className
|
||||
)}
|
||||
onClick={onClick}
|
||||
/>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue