1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 21:06:42 +07:00

fixed attach icons

This commit is contained in:
Fedor Katurov 2019-12-03 17:36:34 +07:00
parent 1eb0fa7be6
commit 5b7077d256
3 changed files with 78 additions and 59 deletions

View file

@ -4,22 +4,25 @@ import { push as historyPush } from 'connected-react-router';
import { Link } from 'react-router-dom';
import { Logo } from '~/components/main/Logo';
import * as style from './style.scss';
import { Filler } from '~/components/containers/Filler';
import { selectUser } from '~/redux/auth/selectors';
import { Group } from '~/components/containers/Group';
import * as MODAL_ACTIONS from '~/redux/modal/actions';
import * as AUTH_ACTIONS from '~/redux/auth/actions';
import { DIALOGS } from '~/redux/modal/constants';
import { pick } from 'ramda';
import pick from 'ramda/es/pick';
import path from 'ramda/es/path';
import { UserButton } from '../UserButton';
import { Notifications } from '../Notifications';
import { URLS } from '~/constants/urls';
import { createPortal } from 'react-dom';
import classNames from 'classnames';
import * as style from './style.scss';
import * as MODAL_ACTIONS from '~/redux/modal/actions';
import * as AUTH_ACTIONS from '~/redux/auth/actions';
const mapStateToProps = state => ({
user: pick(['username', 'is_user', 'photo'])(selectUser(state)),
pathname: path(['router', 'location', 'pathname'], state),
});
const mapDispatchToProps = {
@ -32,11 +35,10 @@ const mapDispatchToProps = {
type IProps = ReturnType<typeof mapStateToProps> & typeof mapDispatchToProps & {};
const HeaderUnconnected: FC<IProps> = memo(
({ user, user: { username, is_user }, showDialog, authLogout, authOpenProfile }) => {
({ user, user: { is_user }, showDialog, pathname, authLogout, authOpenProfile }) => {
const [is_scrolled, setIsScrolled] = useState(false);
const onLogin = useCallback(() => showDialog(DIALOGS.LOGIN), [showDialog]);
// const onProfileClick = useCallback(() => authOpenProfile(username), [authOpenProfile, user]);
const onScroll = useCallback(() => {
const active = window.scrollY > 32;
@ -61,13 +63,20 @@ const HeaderUnconnected: FC<IProps> = memo(
<Filler />
<div className={style.plugs}>
<Link className={style.item} to={URLS.BASE}>
<Link
className={classNames(style.item, { [style.is_active]: pathname === URLS.BASE })}
to={URLS.BASE}
>
ФЛОУ
</Link>
<Link className={style.item} to={URLS.BORIS}>
<Link
className={classNames(style.item, { [style.is_active]: pathname === URLS.BORIS })}
to={URLS.BORIS}
>
БОРИС
</Link>
{is_user && (
<div className={style.item}>
<Notifications />

View file

@ -46,55 +46,6 @@
user-select: none;
text-transform: uppercase;
align-items: center;
& > a.item,
& > div.item {
font: $font_16_medium;
display: flex;
align-items: center;
position: relative;
padding: $gap;
cursor: pointer;
transition: color 0.25s;
text-decoration: none;
color: white;
white-space: nowrap;
&:hover {
color: $red;
}
&:first-child {
padding-left: $spc + $gap;
}
&::after {
content: ' ';
margin-left: $spc;
background: white;
width: 4px;
height: $gap;
display: block;
opacity: 0.2;
border-radius: 4px;
}
&:last-child {
// padding-right: 0;
// &::after {
// display: none;
// }
}
@include tablet {
padding: $gap / 2;
&::after {
margin-left: $gap;
}
}
}
}
.profile {
@ -108,3 +59,62 @@
padding-left: $gap / 2;
cursor: pointer;
}
.item {
font: $font_16_medium;
display: flex;
align-items: center;
position: relative;
padding: $gap $gap * 2;
cursor: pointer;
transition: color 0.25s;
text-decoration: none;
color: white;
white-space: nowrap;
&:hover {
color: $red;
}
&::after {
content: ' ';
margin-left: $spc;
background: white;
width: 4px;
height: $gap;
display: block;
opacity: 0.2;
border-radius: 4px;
position: absolute;
right: -2px;
}
&::before {
content: ' ';
position: absolute;
bottom: 0;
height: 3px;
width: 50%;
right: 50%;
background: white;
transform: translate(50%, 0) scaleX(0);
opacity: 0;
border-radius: 3px;
transition: transform 0.5s, opacity 0.25s;
}
&.is_active {
&::before {
transform: translate(50%, 0) scaleX(1);
opacity: 1;
}
}
@include tablet {
padding: $gap;
&::after {
margin-left: $gap;
}
}
}

View file

@ -244,11 +244,11 @@ const CommentFormUnconnected: FC<IProps> = ({
<Group horizontal className={styles.buttons}>
<ButtonGroup>
<Button iconLeft="image" size="small" color="gray" iconOnly>
<Button iconLeft="photo" size="small" color="gray" iconOnly>
<input type="file" onInput={onInputChange} multiple accept="image/*" />
</Button>
<Button iconRight="enter" size="small" color="gray" iconOnly>
<Button iconRight="audio" size="small" color="gray" iconOnly>
<input type="file" onInput={onInputChange} multiple accept="audio/*" />
</Button>
</ButtonGroup>