App.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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 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'>{{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. .route_container {
  146. width: 80%;
  147. margin: 0 auto;
  148. margin-top: 2rem;
  149. }
  150. #app {
  151. padding-bottom: 2rem;
  152. padding-top: 5rem;
  153. }
  154. .header {
  155. width: 100%;
  156. padding: 1rem 2rem;
  157. position: fixed;
  158. top: 0;
  159. background-color: #fff;
  160. display: flex;
  161. align-items: center;
  162. justify-content: space-between;
  163. border-bottom: 0.125rem solid $color__gray--primary;
  164. @at-root #{&}__group {
  165. display: flex;
  166. > * { margin: 0 0.5rem; }
  167. > *:first-child { margin-left: 0; }
  168. > *:last-child { margin-right: 0; }
  169. }
  170. }
  171. .logo {
  172. @include text($font--role-emphasis, 2rem, normal);
  173. }
  174. .button {
  175. border: 0.125rem solid $color__gray--primary;
  176. display: inline-block;
  177. text-align: center;
  178. @include text($font--role-default, 1rem, 400);
  179. padding: 0.5rem;
  180. cursor: pointer;
  181. background-color: #fff;
  182. transition: background-color 0.2s, border-color 0.2s;
  183. outline: none;
  184. &:hover {
  185. background-color: $color__lightgray--primary;
  186. border-color: $color__gray--darker;
  187. }
  188. &:active {
  189. background-color: $color__lightgray--darker;
  190. border-color: $color__gray--darkest;
  191. }
  192. @at-root #{&}__icon {
  193. }
  194. @at-root #{&}--borderless {
  195. border: 0;
  196. }
  197. @at-root #{&}--orange {
  198. border-color: $color__orange--primary;
  199. &:hover { border-color: $color__orange--darker; }
  200. &:active { border-color: $color__orange--darkest; }
  201. }
  202. @at-root #{&}--green {
  203. background-color: $color__green--primary;
  204. color: #fff;
  205. border-color: $color__green--darker;
  206. &:hover {
  207. border-color: $color__green--darker;
  208. background-color: rgba(75, 171, 79, 0.86);
  209. }
  210. &:active {
  211. border-color: $color__green--darker;
  212. background-color: $color__green--darkester;
  213. }
  214. }
  215. }
  216. .input {
  217. border: 0.125rem solid $color__gray--primary;
  218. @include text;
  219. padding: 0.25rem;
  220. outline: none;
  221. &:hover {
  222. border-color: $color__gray--darker;
  223. }
  224. &:focus {
  225. border-color: $color__gray--darkest;
  226. }
  227. }
  228. .search {
  229. border: 0.125rem solid $color__gray--primary;
  230. &:hover {
  231. border-color: $color__gray--darker;
  232. }
  233. &:focus {
  234. border-color: $color__gray--darkest;
  235. }
  236. @at-root #{&}__field {
  237. outline: none;
  238. height: 100%;
  239. padding: 0 0.5rem;
  240. border: 0;
  241. @include text;
  242. @include placeholder {
  243. @include text;
  244. }
  245. }
  246. }
  247. </style>