App.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div id='app'>
  3. <modal-window name='account'>
  4. <tab-view :tabs='["Sign up", "Login"]' name="account">
  5. <template slot='Sign up'>
  6. <p style='margin-top: 0;'>
  7. Sign up to create and post in threads.
  8. <br/>It only takes a few seconds
  9. </p>
  10. <fancy-input
  11. v-model='signup.username'
  12. placeholder='Username'
  13. width='100%'
  14. >
  15. </fancy-input>
  16. <fancy-input
  17. v-model='signup.password'
  18. placeholder='Password'
  19. type='password'
  20. width='100%'
  21. >
  22. </fancy-input>
  23. <fancy-input
  24. v-model='signup.confirmPassword'
  25. placeholder='Confirm password'
  26. type='password'
  27. width='100%'
  28. >
  29. </fancy-input>
  30. <button class='button' @click='signup'>
  31. Sign up
  32. </button>
  33. <button class='button' @click='cancel'>
  34. Cancel
  35. </button>
  36. </template>
  37. <template slot='Login'>
  38. <p style='margin-top: 0;'>
  39. Login to create and post in threads.
  40. </p>
  41. <fancy-input
  42. v-model='login.username'
  43. placeholder='Username'
  44. width='100%'
  45. >
  46. </fancy-input>
  47. <fancy-input
  48. v-model='login.password'
  49. placeholder='Password'
  50. type='password'
  51. width='100%'
  52. >
  53. </fancy-input>
  54. <button class='button' @click='signup'>
  55. Log in
  56. </button>
  57. <button class='button' @click='cancel'>
  58. Cancel
  59. </button>
  60. </template>
  61. </tab-view>
  62. </modal-window>
  63. <header class='header'>
  64. <div class='header__group'>
  65. <div class='logo'>{{name}}</div>
  66. </div>
  67. <div class='header__group'>
  68. <div class='button button--green' @click='showAccountModal(0)'>
  69. Sign up
  70. </div>
  71. <div class='button' @click='showAccountModal(1)'>
  72. Login
  73. </div>
  74. <div class='search' tabindex='0'>
  75. <input class='search__field' placeholder='Search this forum'>
  76. <button class='button button--borderless'><span class='fa fa-search'></span></button>
  77. </div>
  78. </div>
  79. </header>
  80. <router-view></router-view>
  81. </div>
  82. </template>
  83. <script>
  84. import ModalWindow from './components/ModalWindow'
  85. import TabView from './components/TabView'
  86. import FancyInput from './components/FancyInput'
  87. import mapGetters from 'vuex'
  88. export default {
  89. name: 'app',
  90. components: {
  91. ModalWindow,
  92. TabView,
  93. FancyInput
  94. },
  95. data () {
  96. return {
  97. signup: {
  98. username: '',
  99. password: '',
  100. confirmPassword: ''
  101. },
  102. login: {
  103. username: '',
  104. password: ''
  105. }
  106. }
  107. },
  108. computed: {
  109. name () {
  110. return this.$store.state.meta.name
  111. }
  112. },
  113. methods: {
  114. showAccountModal (index) {
  115. this.$store.commit('showModal', 'account');
  116. this.$store.commit({
  117. type: 'setTab',
  118. tab: 'account',
  119. index: index
  120. });
  121. },
  122. cancel () {
  123. this.$store.commit('hideModal', 'account');
  124. },
  125. signup () {
  126. this.$store.commit('hideModal', 'account');
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang='scss'>
  132. @import url('https://fonts.googleapis.com/css?family=Lato:300,300i,400|Montserrat');
  133. @import './assets/scss/variables.scss';
  134. html, body {
  135. width: 100%;
  136. height: 100%;
  137. margin: 0;
  138. padding: 0;
  139. color: $color__text--primary;
  140. @include text;
  141. }
  142. * {
  143. box-sizing: border-box;
  144. }
  145. #app {
  146. padding-bottom: 2rem;
  147. padding-top: 5rem;
  148. }
  149. .header {
  150. width: 100%;
  151. padding: 1rem 2rem;
  152. position: fixed;
  153. top: 0;
  154. background-color: #fff;
  155. display: flex;
  156. align-items: center;
  157. justify-content: space-between;
  158. border-bottom: 0.125rem solid $color__gray--primary;
  159. @at-root #{&}__group {
  160. display: flex;
  161. > * { margin: 0 0.5rem; }
  162. > *:first-child { margin-left: 0; }
  163. > *:last-child { margin-right: 0; }
  164. }
  165. }
  166. .logo {
  167. @include text($font--role-emphasis, 2rem, normal);
  168. }
  169. .button {
  170. border: 0.125rem solid $color__gray--primary;
  171. display: inline-block;
  172. text-align: center;
  173. @include text($font--role-default, 1rem, 400);
  174. padding: 0.5rem;
  175. cursor: pointer;
  176. background-color: #fff;
  177. transition: background-color 0.2s, border-color 0.2s;
  178. outline: none;
  179. &:hover {
  180. background-color: $color__lightgray--primary;
  181. border-color: $color__gray--darker;
  182. }
  183. &:active {
  184. background-color: $color__lightgray--darker;
  185. border-color: $color__gray--darkest;
  186. }
  187. @at-root #{&}__icon {
  188. }
  189. @at-root #{&}--borderless {
  190. border: 0;
  191. }
  192. @at-root #{&}--orange {
  193. border-color: $color__orange--primary;
  194. &:hover { border-color: $color__orange--darker; }
  195. &:active { border-color: $color__orange--darkest; }
  196. }
  197. }
  198. .input {
  199. border: 0.125rem solid $color__gray--primary;
  200. @include text;
  201. padding: 0.25rem;
  202. outline: none;
  203. &:hover {
  204. border-color: $color__gray--darker;
  205. }
  206. &:focus {
  207. border-color: $color__gray--darkest;
  208. }
  209. }
  210. .search {
  211. border: 0.125rem solid $color__gray--primary;
  212. &:hover {
  213. border-color: $color__gray--darker;
  214. }
  215. &:focus {
  216. border-color: $color__gray--darkest;
  217. }
  218. @at-root #{&}__field {
  219. outline: none;
  220. height: 100%;
  221. padding: 0 0.5rem;
  222. border: 0;
  223. @include text;
  224. @include placeholder {
  225. @include text;
  226. }
  227. }
  228. }
  229. </style>