mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
#23 changed toggle colors
This commit is contained in:
commit
dddb86c778
6 changed files with 52 additions and 32 deletions
|
@ -19,7 +19,7 @@ const BorisSuperpowers: FC<IProps> = ({ active, onChange }) => {
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrap}>
|
<div className={styles.wrap}>
|
||||||
<div className={styles.toggle}>
|
<div className={styles.toggle}>
|
||||||
<Toggle value={active} handler={onChange} />
|
<Toggle value={active} handler={onChange} color="primary" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.left} onClick={onToggle}>
|
<div className={styles.left} onClick={onToggle}>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import React, { FC, useCallback, useEffect, useRef } from 'react';
|
import React, { FC, useCallback } from 'react';
|
||||||
import { IEditorComponentProps } from '~/redux/node/types';
|
import { IEditorComponentProps } from '~/redux/node/types';
|
||||||
import { usePopper } from 'react-popper';
|
|
||||||
import { Button } from '~/components/input/Button';
|
import { Button } from '~/components/input/Button';
|
||||||
|
import { Icon } from '~/components/input/Icon';
|
||||||
|
import styles from './styles.module.scss';
|
||||||
import { Superpower } from '~/components/boris/Superpower';
|
import { Superpower } from '~/components/boris/Superpower';
|
||||||
|
|
||||||
interface IProps extends IEditorComponentProps {}
|
interface IProps extends IEditorComponentProps {}
|
||||||
|
@ -15,9 +16,8 @@ const EditorPublicSwitch: FC<IProps> = ({ data, setData }) => {
|
||||||
return (
|
return (
|
||||||
<Superpower>
|
<Superpower>
|
||||||
<Button
|
<Button
|
||||||
color={data.is_promoted ? 'primary' : 'secondary'}
|
color={data.is_promoted ? 'primary' : 'lab'}
|
||||||
type="button"
|
type="button"
|
||||||
iconLeft={data.is_promoted ? 'waves' : 'lab'}
|
|
||||||
size="giant"
|
size="giant"
|
||||||
label={
|
label={
|
||||||
data.is_promoted
|
data.is_promoted
|
||||||
|
@ -25,8 +25,17 @@ const EditorPublicSwitch: FC<IProps> = ({ data, setData }) => {
|
||||||
: 'Видно только сотрудникам в лаборатории'
|
: 'Видно только сотрудникам в лаборатории'
|
||||||
}
|
}
|
||||||
onClick={onChange}
|
onClick={onChange}
|
||||||
|
className={styles.button}
|
||||||
round
|
round
|
||||||
/>
|
>
|
||||||
|
{data.is_promoted ? (
|
||||||
|
<Icon icon="waves" size={24} />
|
||||||
|
) : (
|
||||||
|
<div className={styles.lab_wrapper}>
|
||||||
|
<Icon icon="lab" size={24} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
</Superpower>
|
</Superpower>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,12 +2,15 @@ import React, { FC, useCallback } from 'react';
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
type ToggleColor = 'primary' | 'secondary' | 'lab' | 'danger';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
value?: boolean;
|
value?: boolean;
|
||||||
handler?: (val: boolean) => void;
|
handler?: (val: boolean) => void;
|
||||||
|
color?: ToggleColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Toggle: FC<IProps> = ({ value, handler }) => {
|
const Toggle: FC<IProps> = ({ value, handler, color = 'primary' }) => {
|
||||||
const onClick = useCallback(() => {
|
const onClick = useCallback(() => {
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
return;
|
return;
|
||||||
|
@ -19,7 +22,7 @@ const Toggle: FC<IProps> = ({ value, handler }) => {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={classNames(styles.toggle, { [styles.active]: value })}
|
className={classNames(styles.toggle, { [styles.active]: value }, styles[color])}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -25,11 +25,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background-color: $wisegreen;
|
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
transform: translate(24px, 0);
|
transform: translate(24px, 0);
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.primary {
|
||||||
|
background-color: $wisegreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.secondary {
|
||||||
|
background-color: transparentize(white, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.lab {
|
||||||
|
background-color: $blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.danger {
|
||||||
|
background-color: $red;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,11 @@ import React, { FC, useCallback, useEffect } from 'react';
|
||||||
import { selectNode, selectNodeComments } from '~/redux/node/selectors';
|
import { selectNode, selectNodeComments } from '~/redux/node/selectors';
|
||||||
import { selectAuthIsTester, selectUser } from '~/redux/auth/selectors';
|
import { selectAuthIsTester, selectUser } from '~/redux/auth/selectors';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { NodeComments } from '~/components/node/NodeComments';
|
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
import { Group } from '~/components/containers/Group';
|
import { Group } from '~/components/containers/Group';
|
||||||
import boris from '~/sprites/boris_robot.svg';
|
import boris from '~/sprites/boris_robot.svg';
|
||||||
import { NodeNoComments } from '~/components/node/NodeNoComments';
|
|
||||||
import { useRandomPhrase } from '~/constants/phrases';
|
import { useRandomPhrase } from '~/constants/phrases';
|
||||||
import { NodeCommentForm } from '~/components/node/NodeCommentForm';
|
|
||||||
import isBefore from 'date-fns/isBefore';
|
import isBefore from 'date-fns/isBefore';
|
||||||
import { Card } from '~/components/containers/Card';
|
|
||||||
import { Footer } from '~/components/main/Footer';
|
|
||||||
import { BorisStats } from '~/components/boris/BorisStats';
|
import { BorisStats } from '~/components/boris/BorisStats';
|
||||||
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
|
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
|
||||||
import { selectBorisStats } from '~/redux/boris/selectors';
|
import { selectBorisStats } from '~/redux/boris/selectors';
|
||||||
|
@ -20,6 +15,10 @@ import { nodeLoadNode } from '~/redux/node/actions';
|
||||||
import { borisLoadStats } from '~/redux/boris/actions';
|
import { borisLoadStats } from '~/redux/boris/actions';
|
||||||
import { Container } from '~/containers/main/Container';
|
import { Container } from '~/containers/main/Container';
|
||||||
import StickyBox from 'react-sticky-box/dist/esnext';
|
import StickyBox from 'react-sticky-box/dist/esnext';
|
||||||
|
import { BorisComments } from '~/components/boris/BorisComments';
|
||||||
|
import { URLS } from '~/constants/urls';
|
||||||
|
import { Route, Switch } from 'react-router-dom';
|
||||||
|
import { BorisUIDemo } from '~/components/boris/BorisUIDemo';
|
||||||
import { BorisSuperpowers } from '~/components/boris/BorisSuperpowers';
|
import { BorisSuperpowers } from '~/components/boris/BorisSuperpowers';
|
||||||
|
|
||||||
type IProps = {};
|
type IProps = {};
|
||||||
|
@ -78,24 +77,18 @@ const BorisLayout: FC<IProps> = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<Card className={styles.content}>
|
{
|
||||||
<Group className={styles.grid}>
|
<Switch>
|
||||||
{user.is_user && <NodeCommentForm isBefore nodeId={node.current.id} />}
|
<Route path={`${URLS.BORIS}/ui`} component={BorisUIDemo} />
|
||||||
|
|
||||||
{node.is_loading_comments ? (
|
<BorisComments
|
||||||
<NodeNoComments is_loading count={7} />
|
isLoadingComments={node.is_loading_comments}
|
||||||
) : (
|
commentCount={node.comment_count}
|
||||||
<NodeComments
|
node={node.current}
|
||||||
comments={comments}
|
comments={node.comments}
|
||||||
count={node.comment_count}
|
/>
|
||||||
user={user}
|
</Switch>
|
||||||
order="ASC"
|
}
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Group>
|
|
||||||
|
|
||||||
<Footer />
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<Group className={styles.stats}>
|
<Group className={styles.stats}>
|
||||||
<StickyBox className={styles.sticky} offsetTop={72} offsetBottom={10}>
|
<StickyBox className={styles.sticky} offsetTop={72} offsetBottom={10}>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$red: #ff3344;
|
$red: #ff3344;
|
||||||
$yellow: #ffd60f;
|
$yellow: #ffd60f;
|
||||||
$dark_blue: #3c75ff;
|
$dark_blue: #3c75ff;
|
||||||
$blue: #3ca1ff;
|
$blue: #582cd0;
|
||||||
$green: #00d2b9;
|
$green: #00d2b9;
|
||||||
//$green: #00503c;
|
//$green: #00503c;
|
||||||
$olive: #8bc12a;
|
$olive: #8bc12a;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue