mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
logindialog initial
This commit is contained in:
parent
9220f09fe5
commit
6066c91060
5 changed files with 56 additions and 4 deletions
42
src/containers/dialogs/LoginDialog/index.tsx
Normal file
42
src/containers/dialogs/LoginDialog/index.tsx
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import React, { FC, useState } from "react";
|
||||||
|
import { ScrollDialog } from "../ScrollDialog";
|
||||||
|
import { IDialogProps } from "~/redux/modal/constants";
|
||||||
|
import { useCloseOnEscape } from "~/utils/hooks";
|
||||||
|
import { Group } from "~/components/containers/Group";
|
||||||
|
import { InputText } from "~/components/input/InputText";
|
||||||
|
import { Button } from "../../../components/input/Button/index";
|
||||||
|
import { Padder } from "~/components/containers/Padder";
|
||||||
|
import * as styles from "./styles.scss";
|
||||||
|
type IProps = IDialogProps & {};
|
||||||
|
|
||||||
|
const LoginDialog: FC<IProps> = ({ onRequestClose }) => {
|
||||||
|
const [username, setUserName] = useState("");
|
||||||
|
const [password, setPassword] = useState("");
|
||||||
|
|
||||||
|
const title = <div>title</div>;
|
||||||
|
|
||||||
|
const buttons = (
|
||||||
|
<Padder>
|
||||||
|
<Group horizontal>
|
||||||
|
<Button title="ВОЙТИ" stretchy />
|
||||||
|
</Group>
|
||||||
|
</Padder>
|
||||||
|
);
|
||||||
|
|
||||||
|
useCloseOnEscape(onRequestClose);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ScrollDialog buttons={buttons} width={300}>
|
||||||
|
<Padder>
|
||||||
|
<div className={styles.wrap}>
|
||||||
|
<Group>
|
||||||
|
<InputText title="Логин" handler={setUserName} value={username} />
|
||||||
|
<InputText title="Пароль" handler={setPassword} value={password} />
|
||||||
|
</Group>
|
||||||
|
</div>
|
||||||
|
</Padder>
|
||||||
|
</ScrollDialog>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export { LoginDialog };
|
6
src/containers/dialogs/LoginDialog/styles.scss
Normal file
6
src/containers/dialogs/LoginDialog/styles.scss
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
.wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
|
@ -56,6 +56,7 @@
|
||||||
|
|
||||||
.pan {
|
.pan {
|
||||||
border-radius: 0 0 $radius $radius;
|
border-radius: 0 0 $radius $radius;
|
||||||
|
box-shadow: transparentize($color: black, $amount: 0.8) 0 8px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@
|
||||||
|
|
||||||
.pan {
|
.pan {
|
||||||
background: darken($content_bg, 4%);
|
background: darken($content_bg, 4%);
|
||||||
height: 64px;
|
max-height: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.children {
|
.children {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { ValueOf } from "~/redux/types";
|
import { ValueOf } from "~/redux/types";
|
||||||
import { HorizontalExample } from "~/containers/examples/HorizontalExample";
|
import { HorizontalExample } from "~/containers/examples/HorizontalExample";
|
||||||
import { ExampleDialog } from "~/containers/dialogs/ExampleDialog";
|
import { ExampleDialog } from "~/containers/dialogs/ExampleDialog";
|
||||||
|
import { LoginDialog } from "~/containers/dialogs/LoginDialog";
|
||||||
|
|
||||||
export const MODAL_ACTIONS = {
|
export const MODAL_ACTIONS = {
|
||||||
SET_SHOWN: "MODAL.SET_SHOWN",
|
SET_SHOWN: "MODAL.SET_SHOWN",
|
||||||
|
@ -9,11 +10,13 @@ export const MODAL_ACTIONS = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DIALOGS = {
|
export const DIALOGS = {
|
||||||
TEST: "TEST"
|
TEST: "TEST",
|
||||||
|
LOGIN: "LOGIN"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DIALOG_CONTENT = {
|
export const DIALOG_CONTENT = {
|
||||||
[DIALOGS.TEST]: ExampleDialog
|
[DIALOGS.TEST]: ExampleDialog,
|
||||||
|
[DIALOGS.LOGIN]: LoginDialog
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IDialogProps {
|
export interface IDialogProps {
|
||||||
|
|
|
@ -10,7 +10,7 @@ export interface IModalState {
|
||||||
|
|
||||||
const INITIAL_STATE: IModalState = {
|
const INITIAL_STATE: IModalState = {
|
||||||
is_shown: true,
|
is_shown: true,
|
||||||
dialog: DIALOGS.TEST
|
dialog: DIALOGS.LOGIN
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createReducer(INITIAL_STATE, MODAL_HANDLERS);
|
export default createReducer(INITIAL_STATE, MODAL_HANDLERS);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue