App.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div id='app'>
  3. <modal-window v-model='showAccountModal'>
  4. <tab-view :tabs='["Sign up", "Login"]' v-model="showAccountTab" padding='true'>
  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 button--green' @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 button--green' @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' @click='$router.push("/")'>{{name}}</div>
  66. </div>
  67. <div class='header__group'>
  68. <div class='button button--green' @click='showAccountModalTab(0)'>
  69. Sign up
  70. </div>
  71. <div class='button' @click='showAccountModalTab(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. showAccountModal: {
  113. get () { return this.$store.state.accountModal },
  114. set (val) {
  115. this.$store.commit('setAccountModalState', val);
  116. }
  117. },
  118. showAccountTab : {
  119. get (val) { return this.$store.state.accountTabs },
  120. set (index) { this.$store.commit('setAccountTabs', index) }
  121. }
  122. },
  123. methods: {
  124. showAccountModalTab (index) {
  125. this.showAccountModal = true
  126. this.showAccountTab = index
  127. },
  128. cancel () {
  129. this.showAccountModal = false
  130. },
  131. signup () {}
  132. }
  133. }
  134. </script>
  135. <style lang='scss'>
  136. @import url('https://fonts.googleapis.com/css?family=Lato:300,300i,400|Montserrat');
  137. @import './assets/scss/variables.scss';
  138. html, body {
  139. width: 100%;
  140. height: 100%;
  141. margin: 0;
  142. padding: 0;
  143. color: $color__text--primary;
  144. @include text;
  145. }
  146. * {
  147. box-sizing: border-box;
  148. }
  149. .route_container {
  150. width: 80%;
  151. margin: 0 auto;
  152. margin-top: 2rem;
  153. padding-bottom: 2rem;
  154. }
  155. #app {
  156. padding-top: 4.5rem;
  157. height: 100%;
  158. }
  159. .header {
  160. width: 100%;
  161. padding: 1rem 2rem;
  162. position: fixed;
  163. top: 0;
  164. z-index: 2;
  165. background-color: #fff;
  166. display: flex;
  167. align-items: center;
  168. justify-content: space-between;
  169. border-bottom: 0.125rem solid $color__gray--primary;
  170. @at-root #{&}__group {
  171. display: flex;
  172. > * { margin: 0 0.5rem; }
  173. > *:first-child { margin-left: 0; }
  174. > *:last-child { margin-right: 0; }
  175. }
  176. }
  177. .logo {
  178. @include text($font--role-emphasis, 2rem, normal);
  179. @include user-select(none);
  180. cursor: pointer;
  181. }
  182. .button {
  183. border: 0.125rem solid $color__gray--primary;
  184. display: inline-block;
  185. text-align: center;
  186. @include text($font--role-default, 1rem, 400);
  187. padding: 0.5rem;
  188. cursor: pointer;
  189. background-color: #fff;
  190. transition: background-color 0.2s, border-color 0.2s;
  191. outline: none;
  192. &:hover {
  193. background-color: $color__lightgray--primary;
  194. border-color: $color__gray--darker;
  195. }
  196. &:active {
  197. background-color: $color__lightgray--darker;
  198. border-color: $color__gray--darkest;
  199. }
  200. @at-root #{&}__icon {
  201. }
  202. @at-root #{&}--borderless {
  203. border: 0;
  204. }
  205. @at-root #{&}--orange {
  206. border-color: $color__orange--primary;
  207. &:hover { border-color: $color__orange--darker; }
  208. &:active { border-color: $color__orange--darkest; }
  209. }
  210. @at-root #{&}--green {
  211. background-color: $color__green--primary;
  212. color: #fff;
  213. border-color: $color__green--darker;
  214. &:hover {
  215. border-color: $color__green--darker;
  216. background-color: rgba(75, 171, 79, 0.86);
  217. }
  218. &:active {
  219. border-color: $color__green--darker;
  220. background-color: $color__green--darkester;
  221. }
  222. }
  223. }
  224. .input {
  225. border: 0.125rem solid $color__gray--primary;
  226. @include text;
  227. padding: 0.25rem;
  228. outline: none;
  229. &:hover {
  230. border-color: $color__gray--darker;
  231. }
  232. &:focus {
  233. border-color: $color__gray--darkest;
  234. }
  235. }
  236. .search {
  237. border: 0.125rem solid $color__gray--primary;
  238. &:hover {
  239. border-color: $color__gray--darker;
  240. }
  241. &:focus {
  242. border-color: $color__gray--darkest;
  243. }
  244. @at-root #{&}__field {
  245. outline: none;
  246. height: 100%;
  247. padding: 0 0.5rem;
  248. border: 0;
  249. @include text;
  250. @include placeholder {
  251. @include text;
  252. }
  253. }
  254. }
  255. </style>