mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
better sidepane
This commit is contained in:
parent
1b001db91a
commit
e315b33284
19 changed files with 253 additions and 99 deletions
|
@ -7,6 +7,7 @@ interface IProps {
|
|||
width?: number;
|
||||
title?: string;
|
||||
is_hero?: boolean;
|
||||
is_stamp?: boolean;
|
||||
}
|
||||
|
||||
const Cell: FC<IProps> = ({
|
||||
|
@ -14,6 +15,7 @@ const Cell: FC<IProps> = ({
|
|||
height = 1,
|
||||
title,
|
||||
is_hero,
|
||||
is_stamp,
|
||||
}) => (
|
||||
<div
|
||||
className={classNames(styles.cell, { is_hero })}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import * as React from 'react';
|
||||
import { Cell } from "~/components/flow/Cell";
|
||||
import { range } from 'ramda';
|
||||
|
||||
const style = require('./style.scss');
|
||||
|
||||
|
@ -11,13 +12,14 @@ export const TestGrid = () => (
|
|||
title="Example cell Example cell Example cell Example cell Example cell Example cell Example cell "
|
||||
is_hero
|
||||
/>
|
||||
|
||||
<Cell />
|
||||
<Cell
|
||||
height={2}
|
||||
title="Example cell Example cell Example cell Example cell Example cell Example cell Example cell "
|
||||
/>
|
||||
<Cell width={2} />
|
||||
<Cell />
|
||||
{
|
||||
range(1,20).map(el => (
|
||||
<Cell
|
||||
width={1}
|
||||
height={1}
|
||||
title="Example cell Example cell Example cell Example cell Example cell Example cell Example cell "
|
||||
/>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -7,8 +7,8 @@ import { userSendLoginRequest, userSetLoginError } from "~/redux/user/actions";
|
|||
import { IUserFormStateLogin, IUserState } from "~/redux/user/reducer";
|
||||
import { Info } from "~/components/input/Info";
|
||||
|
||||
const login = require('~/containers/LoginLayout/style');
|
||||
const style = require('./style.scss');
|
||||
import * as login from '~/containers/login/LoginLayout/styles.scss';
|
||||
import * as style from './style.scss';
|
||||
|
||||
interface ILoginFormProps {
|
||||
error: IUserFormStateLogin['error'],
|
||||
|
|
|
@ -1,25 +1,38 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import React, { FC, LegacyRef, ReactChild, useCallback, useEffect, useState } from 'react';
|
||||
import * as styles from './styles.scss';
|
||||
import classNames from 'classnames';
|
||||
|
||||
export const SidePane = ({ }) => {
|
||||
interface IProps {
|
||||
container: React.RefObject<HTMLDivElement>;
|
||||
}
|
||||
|
||||
export const SidePane: FC<IProps> = ({
|
||||
container,
|
||||
}) => {
|
||||
const [left, setLeft] = useState(0);
|
||||
|
||||
const moveThis = () => {
|
||||
const shift = ((document.body.getBoundingClientRect().width - 1024) / 2) - 54 - 10;
|
||||
const moveThis = useCallback(() => {
|
||||
const shift = window.innerWidth > (1024 + 64 + 20)
|
||||
? ((window.innerWidth - 1024 - 64 - 20) / 2) - 54 - 10 + 64
|
||||
: 10;
|
||||
|
||||
setLeft(shift);
|
||||
};
|
||||
console.log({ shift });
|
||||
}, [setLeft, container]);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('resize', moveThis)
|
||||
moveThis();
|
||||
window.addEventListener('resize', moveThis);
|
||||
document.addEventListener('DOMContentLoaded', moveThis);
|
||||
|
||||
return () => { window.removeEventListener('resize', moveThis); }
|
||||
});
|
||||
|
||||
useEffect(moveThis, []);
|
||||
return () => {
|
||||
window.removeEventListener('resize', moveThis);
|
||||
document.removeEventListener('DOMContentLoaded', moveThis);
|
||||
}
|
||||
}, [container]);
|
||||
|
||||
return (
|
||||
<div className={styles.pane} style={{ left }}>
|
||||
<div className={styles.pane} style={{ transform: `translate(${left}px, 0px)` }}>
|
||||
<div className={classNames(styles.group, 'logo')} />
|
||||
|
||||
<div className={styles.group}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue