Skip to content

Commit

Permalink
feat: add login dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
uniquemo committed Apr 24, 2020
1 parent 5ab34ee commit 95ea239
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/components/Layout/Footer/style.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@value colors: "~styles/colors.module.css";
@value red from colors;

.root {
width: 100%;
height: 60px;
Expand Down Expand Up @@ -46,14 +49,14 @@
& .next svg {
width: 20px;
height: 20px;
color: rgb(208, 53, 49);
color: red;
}

& .pause {
width: 40px;
height: 40px;
border-radius: 50%;
background-color: rgb(208, 53, 49);
background-color: red;
display: flex;
align-items: center;
justify-content: center;
Expand Down
37 changes: 37 additions & 0 deletions src/components/Layout/Sidebar/LoginDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react'
import { Dialog, InputGroup, Button, IDialogProps } from '@blueprintjs/core'

import styles from './style.module.css'

const LoginDialog: React.FC<IDialogProps> = ({ isOpen, onClose }) => {
const handleLogin = () => {
console.log('login')
}

return (
<Dialog
style={{ width: '400px' }}
title='登录'
isOpen={isOpen}
onClose={onClose}
>
<div className={styles.content}>
<InputGroup
placeholder='请输入手机号'
leftIcon='mobile-phone'
/>
<InputGroup
placeholder='请输入密码'
leftIcon='lock'
type='password'
/>

<div className={styles.loginBtn}>
<Button onClick={handleLogin}>登录</Button>
</div>
</div>
</Dialog>
)
}

export default LoginDialog
15 changes: 15 additions & 0 deletions src/components/Layout/Sidebar/LoginDialog/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.content {
padding: 30px 30px 0;

> div {
margin-bottom: 20px;
}

.loginBtn {
text-align: right;

button {
width: 30%;
}
}
}
19 changes: 18 additions & 1 deletion src/components/Layout/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,30 @@ import React from 'react'
import { Icon } from '@blueprintjs/core'
import cn from 'classnames'

import LoginDialog from './LoginDialog'
import styles from './style.module.css'

const { useState } = React

const Sidebar = () => {
const isLogged = true
const [showLoginDialog, setShowLoginDialog] = useState(false)

const handleNameClicke = () => {
setShowLoginDialog(true)
}

const handleLoginDialogClose = () => {
setShowLoginDialog(false)
}

return (
<div className={styles.root}>
<div className={styles.user}>
<div className={styles.avatar}>
{isLogged ? <Icon icon='person' /> : <img />}
</div>
<div className={styles.name}>
<div className={styles.name} onClick={handleNameClicke}>
<span>momo_Unique</span>
<Icon icon='play' />
</div>
Expand Down Expand Up @@ -47,6 +59,11 @@ const Sidebar = () => {
</div>
</div>
</div>

<LoginDialog
isOpen={showLoginDialog}
onClose={handleLoginDialogClose}
/>
</div>
)
}
Expand Down
3 changes: 0 additions & 3 deletions src/global.module.css

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import App from './pages/App'
import 'normalize.css/normalize.css'
import '@blueprintjs/icons/lib/css/blueprint-icons.css'
import '@blueprintjs/core/lib/css/blueprint.css'
import './global.module.css'
import './styles/global.module.css'

const Root = () => {
return (
Expand Down
1 change: 1 addition & 0 deletions src/styles/colors.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@value red: #c7332f;
7 changes: 7 additions & 0 deletions src/styles/global.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
html {
font-size: 100px;
}

button {
outline: none !important;
}

0 comments on commit 95ea239

Please sign in to comment.