Skip to content

Commit

Permalink
refactor: re-organize components
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmlzhou committed Sep 13, 2019
1 parent baefc26 commit e863ccb
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 67 deletions.
26 changes: 19 additions & 7 deletions login-form/App.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
<template>
<div id="app" class="app">
<router-view/>
<router-view></router-view>
</div>
</template>

<style>
@import url("https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css");
@import url('https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css');
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
text-decoration: inherit;
}
ul, ol {
ul,
ol {
list-style: none;
}
input, select, button {
input,
select,
button {
font: inherit;
}
html, body {
html,
body {
height: 100%;
}
body {
background-color: #007dff;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.app {
display: flex;
height: 100%;
align-items: center;
}
</style>
Binary file removed login-form/assets/logo.png
Binary file not shown.
15 changes: 8 additions & 7 deletions login-form/components/LoginCheckbox.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template>
<span class="login_checkbox">
<input :id="id" type="checkbox" />
<label :for="id">{{label}}</label>
<label :for="id">{{ label }}</label>
</span>
</template>
<script>
let GID = 1
export default {
props: {
label: {
Expand All @@ -23,8 +24,8 @@ export default {
.login_checkbox input {
display: none;
}
.login_checkbox label::before,
.login_checkbox label::after {
.login_checkbox label:before,
.login_checkbox label:after {
content: '';
display: inline-block;
margin-right: 5px;
Expand All @@ -33,12 +34,12 @@ export default {
height: 14px;
vertical-align: top;
}
.login_checkbox label::before {
border-radius: 3px;
.login_checkbox label:before {
border-radius: 2px;
background-color: white;
box-shadow: 0 1px 1px #0066d0;
}
.login_checkbox label::after {
.login_checkbox label:after {
content: '\f00c';
position: relative;
display: none;
Expand All @@ -51,7 +52,7 @@ export default {
color: #007dff;
float: left;
}
.login_checkbox input:checked+label::after {
.login_checkbox input:checked + label:after {
display: inline-block;
}
</style>
12 changes: 7 additions & 5 deletions login-form/components/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<login-textfield label="Email address" icon="envelope-o" />
</div>
<div class="login_form_r3">
<login-textfield label="Enter passwords" icon="lock" />
<login-textfield label="Enter password" icon="lock" />
</div>
<div class="login_form_r4">
<login-textfield label="Re-enter passwords" icon="lock" />
<login-textfield label="Re-enter password" icon="lock" />
</div>
<div class="login_form_r5">
<login-checkbox label="Keep me sign in" />
Expand All @@ -28,6 +28,7 @@
import LoginTextfield from './LoginTextfield'
import LoginCheckbox from './LoginCheckbox'
import LoginSubmit from './LoginSubmit'
export default {
components: {
LoginTextfield,
Expand All @@ -40,12 +41,12 @@ export default {
.login_form {
padding: 20px;
}
.login_form>div {
.login_form > div {
padding-bottom: 10px;
display: flex;
min-height: 40px;
justify-content: space-between;
transition: all .6s ease;
transition: all 0.6s ease;
}
.login_text {
display: flex;
Expand All @@ -62,7 +63,8 @@ export default {
}
.login__signup .login_form_r5 {
opacity: 0;
transition-duration: .4s;
/* transform: translateY(100%); */
transition-duration: 0.4s;
}
.login__signup .login_button label:nth-child(2) {
transform: translateY(-100%);
Expand Down
6 changes: 3 additions & 3 deletions login-form/components/LoginSubmit.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<span class="login_button">
<input type="button" />
<input type="button" value="" />
<label>Sign In</label>
<label>Sign Up</label>
</span>
Expand All @@ -20,7 +20,7 @@
border: none;
border-radius: 2px;
outline: none;
background: #0066d0
background: #0066d0;
}
.login_button label {
position: absolute;
Expand All @@ -29,6 +29,6 @@
align-items: center;
justify-content: center;
display: flex;
transition: all .6s ease;
transition: all 0.6s ease;
}
</style>
35 changes: 18 additions & 17 deletions login-form/components/LoginTabs.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<ul class="login_tabs">
<li><span>Sign up</span></li>
<li><span href="#">Sign up</span></li>
<li class="login_tabs_s">or</li>
<li><span>Sign in</span></li>
<li><span href="#">Sign in</span></li>
</ul>
</template>
<style>
Expand All @@ -16,31 +16,32 @@
flex: 1;
justify-content: space-around;
align-items: center;
transition: all .6s ease;
transition: all 0.6s ease;
}
.login_tabs span {
display: block;
padding: 4px 10px;
border: 1px solid white;
border-radius: 3px;
color: white;
text-align: center;
transition: all .6s ease;
transition: all 0.3s ease;
}
.login_tabs .login_tabs_s {
justify-content: center;
transition-duration: .55s;
transition-delay: .05s;
transition-duration: 0.55s;
transition-delay: 0.05s;
}
.login_tabs_s {
font-size: 12px;
}
.login_tabs_s::before,
.login_tabs_s::after {
.login_tabs_s:before,
.login_tabs_s:after {
content: '-';
}
.login__signup .login_tabs li:first-child {
transition-duration: .5s;
transition-delay: .1s;
transition-duration: 0.5s;
transition-delay: 0.1s;
transform: translateX(100%) scale(1.5);
}
.login__signup .login_tabs li:first-child span {
Expand All @@ -55,19 +56,19 @@
opacity: 0.8;
}
.login__signin .login_tabs li:last-child {
transition-duration: .5s;
transition-delay: .1s;
transition-duration: 0.5s;
transition-delay: 0.1s;
transform: translateX(-100%) scale(1.5);
}
.login__signin .login_tabs li:last-child span {
border-color: transparent;
border-color: transparent;
}
.login__signin .login_tabs li:first-child {
transform: scale(0.6);
opacity: 0.4;
transform: scale(0.6);
opacity: 0.4;
}
.login__signin .login_tabs_s {
transform: translateX(-58%);
opacity: 0.8;
transform: translateX(-58%);
opacity: 0.8;
}
</style>
4 changes: 2 additions & 2 deletions login-form/components/LoginTextfield.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<span class="login_textfield">
<label><i v-if="icon" :class="['fa', `fa-${icon}`]"></i> {{label}}</label>
<label><i v-if="icon" :class="['fa', `fa-${icon}`]"></i> {{ label }}</label>
<input type="text" />
</span>
</template>
Expand Down Expand Up @@ -36,8 +36,8 @@ export default {
.login_textfield input {
flex: 1;
width: 0;
padding: 0;
margin: 0;
padding: 0;
border: none;
outline: none;
}
Expand Down
6 changes: 3 additions & 3 deletions login-form/router.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import Login from './views/Login'

Vue.use(Router)

Expand All @@ -10,8 +10,8 @@ export default new Router({
routes: [
{
path: '/',
name: 'home',
component: Home
name: 'login',
component: Login
}
]
})
12 changes: 3 additions & 9 deletions login-form/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import Vuex from 'vuex'
Vue.use(Vuex)

export default new Vuex.Store({
state: {

},
mutations: {

},
actions: {

}
state: {},
mutations: {},
actions: {}
})
11 changes: 0 additions & 11 deletions login-form/views/Home.vue

This file was deleted.

10 changes: 7 additions & 3 deletions login-form/components/Login.vue → login-form/views/Login.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<template>
<div class="login" :class="{ login__signin: isSignIn, login__signup: isSignUp }">
<div
class="login"
:class="{ login__signin: isSignIn, login__signup: isSignUp }"
>
<login-tabs @click.native="switchState" />
<login-form />
</div>
</template>
<script>
import LoginTabs from './LoginTabs'
import LoginForm from './LoginForm'
import LoginTabs from '../components/LoginTabs'
import LoginForm from '../components/LoginForm'
export default {
components: {
LoginTabs,
Expand Down

0 comments on commit e863ccb

Please sign in to comment.