Updated both signin and register with new seasoned-button and -input components. Still needs some styling fixed, duplicated scoped styling
This commit is contained in:
@@ -1,32 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="profile">
|
<section class="profile">
|
||||||
<div class="profile__content">
|
<div class="profile__content">
|
||||||
<header class="profile__header">
|
<h2 class='settings__header'>Register new user</h2>
|
||||||
<h2 class="profile__title">Register new user</h2>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<form class="form">
|
<form class="form">
|
||||||
<div class="form__buffer"></div>
|
<seasoned-input text="username" icon="Email"
|
||||||
|
@inputValue="setValue('username', $event)"></seasoned-input>
|
||||||
<div class="center">
|
<seasoned-input text="password" icon="Keyhole" type="password"
|
||||||
<div class="form__group">
|
@inputValue="setValue('password', $event)"></seasoned-input>
|
||||||
<svg class="form__group__input-icon">
|
<seasoned-input text="repeat password" icon="Keyhole" type="password"
|
||||||
<use xlink:href="#iconEmail"></use>
|
@inputValue="setValue('passwordRepeat', $event)"></seasoned-input>
|
||||||
</svg>
|
|
||||||
<input class="form__group-input" type="username" ref="username" placeholder="Username" >
|
|
||||||
</div>
|
|
||||||
<div class="form__group">
|
|
||||||
<svg class="form__group__input-icon">
|
|
||||||
<use xlink:href="#iconKeyhole"></use>
|
|
||||||
</svg>
|
|
||||||
<input class="form__group-input" type="password" ref="password" placeholder="Password">
|
|
||||||
</div>
|
|
||||||
<div class="form__group">
|
|
||||||
<svg class="form__group__input-icon">
|
|
||||||
<use xlink:href="#iconKeyhole"></use>
|
|
||||||
</svg>
|
|
||||||
<input class="form__group-input" type="password" ref="password_re" placeholder="Repeat password">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<transition name="message-fade">
|
<transition name="message-fade">
|
||||||
<div class="message" :class="messageClass" v-if="showMessage">
|
<div class="message" :class="messageClass" v-if="showMessage">
|
||||||
@@ -36,8 +19,7 @@
|
|||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<div class="form__group">
|
<div class="form__group">
|
||||||
<button type="button" class="button" v-on:click="requestNewUser">Register</button>
|
<seasoned-button @click="requestNewUser">Register</seasoned-button>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -47,12 +29,11 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <created-lists></created-lists> -->
|
|
||||||
</div>
|
</div>
|
||||||
<section class="not-found" v-if="userLoggedIn === false">
|
<section class="not-found" v-if="userLoggedIn === false">
|
||||||
<div class="not-found__content">
|
<div class="not-found__content">
|
||||||
<h2 class="not-found__title">Authentication Request Failed</h2>
|
<h2 class="not-found__title">Authentication Request Failed</h2>
|
||||||
<button class="not-found__button button" @click="requestToken">Log In</button>
|
<button class="not-found__button button">Log In</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
@@ -61,15 +42,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import storage from '../storage.js'
|
import storage from '../storage.js'
|
||||||
import MoviesList from './MoviesList.vue'
|
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
||||||
// import CreatedLists from './CreatedLists.vue'
|
import SeasonedInput from '@/components/ui/SeasonedInput.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { MoviesList },
|
components: { SeasonedButton, SeasonedInput },
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
userLoggedIn: '',
|
userLoggedIn: '',
|
||||||
userName: '',
|
username: undefined,
|
||||||
|
password: undefined,
|
||||||
|
passwordRepeat: undefined,
|
||||||
showMessage: false,
|
showMessage: false,
|
||||||
messageClass: 'message-success',
|
messageClass: 'message-success',
|
||||||
messageText: 'hello world'
|
messageText: 'hello world'
|
||||||
@@ -77,9 +60,9 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
requestNewUser(){
|
requestNewUser(){
|
||||||
let username = this.$refs.username.value;
|
let username = this.username
|
||||||
let password = this.$refs.password.value;
|
let password = this.password
|
||||||
let password_re = this.$refs.password_re.value;
|
let password_re = this.passwordRepeat
|
||||||
|
|
||||||
let verifyCredentials = this.checkCredentials(username, password, password_re);
|
let verifyCredentials = this.checkCredentials(username, password, password_re);
|
||||||
|
|
||||||
@@ -142,6 +125,9 @@ export default {
|
|||||||
dismissMessage(){
|
dismissMessage(){
|
||||||
this.showMessage = false;
|
this.showMessage = false;
|
||||||
},
|
},
|
||||||
|
setValue(l, t) {
|
||||||
|
this[l] = t
|
||||||
|
},
|
||||||
logOut(){
|
logOut(){
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
eventHub.$emit('setUserStatus');
|
eventHub.$emit('setUserStatus');
|
||||||
@@ -158,110 +144,57 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
@import "./src/scss/variables";
|
@import "./src/scss/variables";
|
||||||
@import "./src/scss/media-queries";
|
@import "./src/scss/media-queries";
|
||||||
.message-enter-active {
|
@import "./src/scss/message";
|
||||||
transition: all .3s ease;
|
|
||||||
}
|
// DUPLICATE CODE
|
||||||
.message-fade-leave-active {
|
.settings {
|
||||||
transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
|
padding: 35px;
|
||||||
}
|
|
||||||
.message-fade-enter, .message-fade-leave-to {
|
&__header {
|
||||||
opacity: 0;
|
margin: 0;
|
||||||
}
|
line-height: 16px;
|
||||||
.message{
|
color: $c-dark;
|
||||||
width: 75%;
|
|
||||||
max-width: 35rem;
|
|
||||||
margin: 0 auto;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
padding: 12px 15px 12px 15px;
|
|
||||||
position: relative;
|
|
||||||
&-text{
|
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
&-dismiss{
|
|
||||||
position: absolute;
|
|
||||||
font-size: 17px;
|
|
||||||
font-weight: 100;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
margin-top: 2px;
|
|
||||||
margin-right: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
.profile__content {
|
||||||
|
padding: 35px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-warning{
|
|
||||||
background-color: #f2dede;
|
|
||||||
border: 1px solid #b75b91;
|
|
||||||
color: #b75b91;
|
|
||||||
}
|
|
||||||
.message-success{
|
|
||||||
background-color: #dff0d9;
|
|
||||||
border: 1px solid #3e7549;
|
|
||||||
color: #3e7549;
|
|
||||||
}
|
|
||||||
|
|
||||||
.center {
|
.center {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form {
|
.form {
|
||||||
z-index: 15;
|
// TODO, fix this. if single child it adds weird margin
|
||||||
background-color: $c-light;
|
> div:last-child {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
@include tablet-min{
|
|
||||||
}
|
|
||||||
&__buffer{
|
|
||||||
width: 100%;
|
|
||||||
height: 4rem;
|
|
||||||
}
|
|
||||||
&__group{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
@include tablet-min{
|
|
||||||
}
|
|
||||||
&-input{
|
|
||||||
width: 75%;
|
|
||||||
max-width: 35rem;
|
|
||||||
padding: 15px 10px 15px 45px;
|
|
||||||
outline: none;
|
|
||||||
background-color: $c-white;
|
|
||||||
color: $c-dark;
|
|
||||||
font-weight: 100;
|
|
||||||
font-size: 20px;
|
|
||||||
border: 1px solid $c-dark;
|
|
||||||
margin-left: -2.2rem;
|
|
||||||
z-index: 3;
|
|
||||||
&:focus, &:hover {
|
|
||||||
border-color: $c-dark;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-input[type="username"] {
|
|
||||||
margin-bottom: 3rem;
|
|
||||||
}
|
|
||||||
&__input-icon{
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
fill: rgba($c-dark, 0.5);
|
|
||||||
transition: fill 0.5s ease;
|
|
||||||
pointer-events: none;
|
|
||||||
margin-top: 15px;
|
|
||||||
margin-left: 15px;
|
|
||||||
z-index: 8;
|
|
||||||
}
|
|
||||||
&-link{
|
|
||||||
text-decoration: none;
|
|
||||||
color: black;
|
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
&-signin{
|
|
||||||
text-transform: uppercase;
|
&__group{
|
||||||
font-weight: 300;
|
justify-content: unset;
|
||||||
font-size: 11px;
|
&__input-icon {
|
||||||
line-height: 2;
|
margin-top: 8px;
|
||||||
letter-spacing: 0.5px;
|
height: 22px;
|
||||||
|
width: 22px;
|
||||||
|
}
|
||||||
|
&-input {
|
||||||
|
padding: 10px 5px 10px 45px;
|
||||||
|
height: 40px;
|
||||||
|
font-size: 17px;
|
||||||
|
width: 75%;
|
||||||
|
// @include desktop-min {
|
||||||
|
// width: 400px;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="profile">
|
<section class="profile">
|
||||||
<div class="profile__content">
|
<div class="profile__content">
|
||||||
<header class="profile__header">
|
<h2 class='settings__header'>Sign in</h2>
|
||||||
<h2 class="profile__title">Register new user</h2>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<form class="form">
|
<form class="form">
|
||||||
<div class="form__buffer"></div>
|
<div class="form__buffer"></div>
|
||||||
<div>
|
|
||||||
<div class="form__group">
|
<seasoned-input text="username" icon="Email" type="username"
|
||||||
<svg class="form__group__input-icon">
|
@inputValue="setValue('username', $event)" />
|
||||||
<use xlink:href="#iconEmail"></use>
|
<seasoned-input text="username" icon="Keyhole" type="password"
|
||||||
</svg>
|
@inputValue="setValue('password', $event)" />
|
||||||
<input class="form__group-input" type="username" ref="username" placeholder="Username" >
|
|
||||||
</div>
|
<seasoned-button @click="signin">sign in</seasoned-button>
|
||||||
<div class="form__group">
|
|
||||||
<svg class="form__group__input-icon">
|
|
||||||
<use xlink:href="#iconKeyhole"></use>
|
|
||||||
</svg>
|
|
||||||
<input class="form__group-input" type="password" ref="password" placeholder="Password" v-on:keyup.enter="signin">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<transition name="message-fade">
|
<transition name="message-fade">
|
||||||
<div class="message" :class="messageClass" v-if="showMessage">
|
<div class="message" :class="messageClass" v-if="showMessage">
|
||||||
@@ -27,11 +19,6 @@
|
|||||||
<span class="message-dismiss" @click="showMessage=false">X</span>
|
<span class="message-dismiss" @click="showMessage=false">X</span>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<div class="form__group">
|
|
||||||
<button type="button" class="button" v-on:click="signin">Sign in</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="form__group">
|
<div class="form__group">
|
||||||
@@ -40,7 +27,6 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <created-lists></created-lists> -->
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -48,24 +34,28 @@
|
|||||||
<script>
|
<script>
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import storage from '../storage.js'
|
import storage from '../storage.js'
|
||||||
import MoviesList from './MoviesList.vue'
|
import SeasonedInput from '@/components/ui/SeasonedInput.vue'
|
||||||
// import CreatedLists from './CreatedLists.vue'
|
import SeasonedButton from '@/components/ui/SeasonedButton.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { MoviesList },
|
components: { SeasonedInput, SeasonedButton },
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
userLoggedIn: '',
|
userLoggedIn: '',
|
||||||
userName: '',
|
|
||||||
showMessage: false,
|
showMessage: false,
|
||||||
messageClass: 'message-success',
|
messageClass: 'message-success',
|
||||||
messageText: 'hello world'
|
messageText: 'hello world',
|
||||||
|
username: undefined,
|
||||||
|
password: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
setValue(l, t) {
|
||||||
|
this[l] = t
|
||||||
|
},
|
||||||
signin(){
|
signin(){
|
||||||
let username = this.$refs.username.value;
|
let username = this.username;
|
||||||
let password = this.$refs.password.value;
|
let password = this.password;
|
||||||
|
|
||||||
axios.post(`https://api.kevinmidboe.com/api/v1/user/login`, {
|
axios.post(`https://api.kevinmidboe.com/api/v1/user/login`, {
|
||||||
username: username,
|
username: username,
|
||||||
@@ -118,5 +108,51 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
|
@import "./src/scss/variables";
|
||||||
|
@import "./src/scss/message";
|
||||||
|
|
||||||
|
// DUPLICATE CODE
|
||||||
|
.settings {
|
||||||
|
padding: 35px;
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
margin: 0;
|
||||||
|
line-height: 16px;
|
||||||
|
color: $c-dark;
|
||||||
|
font-weight: 300;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.profile__content {
|
||||||
|
padding: 35px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form {
|
||||||
|
> div:last-child {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__group{
|
||||||
|
justify-content: unset;
|
||||||
|
&__input-icon {
|
||||||
|
margin-top: 8px;
|
||||||
|
height: 22px;
|
||||||
|
width: 22px;
|
||||||
|
}
|
||||||
|
&-input {
|
||||||
|
padding: 10px 5px 10px 45px;
|
||||||
|
height: 40px;
|
||||||
|
font-size: 17px;
|
||||||
|
width: 75%;
|
||||||
|
// @include desktop-min {
|
||||||
|
// width: 400px;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user