|
1 | 1 | <template> |
2 | | - <div> |
3 | | - Login |
| 2 | + <div id="authentication"> |
| 3 | + <section id="login"> |
| 4 | + <Login /> |
| 5 | + <a id="go-to-login" @click="goToRegister">Don't have an account? <span class="link-color">Register</span></a> |
| 6 | + </section> |
| 7 | + <section id="register" class="hidden"> |
| 8 | + <Register /> |
| 9 | + <a id="go-to-register" @click="goToLogin">Already have an account? <span class="link-color">Login</span></a> |
| 10 | + </section> |
4 | 11 | </div> |
5 | 12 | </template> |
| 13 | + |
| 14 | +<script setup> |
| 15 | +import Login from '@/components/authentication/Login.vue'; |
| 16 | +import Register from '@/components/authentication/Register.vue'; |
| 17 | +
|
| 18 | +const goToLogin = () => { |
| 19 | + document.getElementById('login').classList.remove('hidden'); |
| 20 | + document.getElementById('register').classList.add('hidden'); |
| 21 | +}; |
| 22 | +
|
| 23 | +const goToRegister = () => { |
| 24 | + document.getElementById('login').classList.add('hidden'); |
| 25 | + document.getElementById('register').classList.remove('hidden'); |
| 26 | +}; |
| 27 | +</script> |
| 28 | + |
| 29 | +<style scoped> |
| 30 | +a { |
| 31 | + cursor: pointer; |
| 32 | +} |
| 33 | +
|
| 34 | +section { |
| 35 | + display: flex; |
| 36 | + flex-direction: column; |
| 37 | + align-items: center; |
| 38 | +} |
| 39 | +
|
| 40 | +.link-color { |
| 41 | + color: var(--color-primary); |
| 42 | +} |
| 43 | +
|
| 44 | +#authentication { |
| 45 | + display: flex; |
| 46 | + align-items: center; |
| 47 | +} |
| 48 | +
|
| 49 | +:deep(button[type="submit"]) { |
| 50 | + margin-top: 1rem; |
| 51 | +} |
| 52 | +
|
| 53 | +:deep(input[type="checkbox"]) { |
| 54 | + display: none; |
| 55 | +} |
| 56 | +
|
| 57 | +:deep(form) { |
| 58 | + display: flex; |
| 59 | + width: clamp(300px, 80%, 600px); |
| 60 | + flex-direction: column; |
| 61 | + border: 1px solid var(--background-color-secondary); |
| 62 | + padding: 2rem; |
| 63 | + border-radius: var(--border-radius); |
| 64 | + gap: 1rem; |
| 65 | +} |
| 66 | +
|
| 67 | +:deep(form>div) { |
| 68 | + display: flex; |
| 69 | + flex-direction: column; |
| 70 | +} |
| 71 | +
|
| 72 | +:deep(input) { |
| 73 | + padding: 0.5rem; |
| 74 | + border: none; |
| 75 | + border-radius: var(--border-radius); |
| 76 | + width: calc(100% - 0.5rem * 2); |
| 77 | +} |
| 78 | +
|
| 79 | +:deep(.password-input>label) { |
| 80 | + background-image: "url(../images/tabler--eye.svg)"; |
| 81 | + height: 2rem; |
| 82 | + width: 2rem; |
| 83 | + background-repeat: no-repeat; |
| 84 | + background-size: contain; |
| 85 | + cursor: pointer; |
| 86 | +} |
| 87 | +
|
| 88 | +:deep(.show-password-check:checked+label.show-password) { |
| 89 | + background-image: "url(../images/tabler--eye-off.svg)"; |
| 90 | +} |
| 91 | +
|
| 92 | +/* Pseudo-elements */ |
| 93 | +
|
| 94 | +:deep(input:placeholder-shown) { |
| 95 | + border-bottom: 1px solid light-dark(black, white); |
| 96 | +} |
| 97 | +
|
| 98 | +:deep( |
| 99 | + input:user-valid, |
| 100 | + input.valid |
| 101 | +) { |
| 102 | + background-color: rgb(0 255 0 / 5%); |
| 103 | + border: 1px solid green; |
| 104 | + box-sizing: border-box; |
| 105 | + width: 100%; |
| 106 | +} |
| 107 | +
|
| 108 | +:deep( |
| 109 | + input:user-invalid, |
| 110 | + input.invalid |
| 111 | +) { |
| 112 | + background-color: rgb(255 0 0 / 5%); |
| 113 | + border: 1px solid red; |
| 114 | + box-sizing: border-box; |
| 115 | + width: 100%; |
| 116 | +} |
| 117 | +</style> |
0 commit comments