Skip to content

Commit

Permalink
S8-Design Tweaks Part 4 (#231)
Browse files Browse the repository at this point in the history
* Reworked Main Card Views
* Built out new Components
* More Design Refactoring
  • Loading branch information
DarkPurple141 authored Oct 16, 2018
1 parent d0fd394 commit aa2e6e8
Show file tree
Hide file tree
Showing 54 changed files with 773 additions and 480 deletions.
3 changes: 2 additions & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ html, body {
--white: #fefefe;
--soft-white: #aaa;
--black: #111;
--soft-black: rgba(#111, 0.65);
--soft-black: rgba(#111, 0.5);
--black-p: rgba(0,0,0,.72);
// borders
--color-gray: #d5d5d5;
Expand All @@ -62,6 +62,7 @@ html, body {
--box-shadow-active: 0px 0px 0px 1px #ddd;
--theme: #00a99d;
--theme-light: rgba(102, 203, 196);
--color-blue: #2196f3;
// font format
--header-1: 600 3rem /1.2 -apple-system, BlinkMacSystemFont, 'Open Sans', 'Helvetica Neue', sans-serif;
--header-1-mobile: 600 2rem /1.1 -apple-system, BlinkMacSystemFont, 'Open Sans', 'Helvetica Neue', sans-serif;
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/AppBreadCrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export default {
}
}
// only first three items
return list.slice(0, 3)
return list.slice(Math.max(0, list.length - 4), list.length - 1)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/AppButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
button {
cursor: pointer;
padding: 10px 20px;
margin: 0px 4px;
margin: 4px;
font: inherit;
font-weight: bolder;
outline: none;
Expand All @@ -34,7 +34,7 @@ button:disabled {
}
.standard-button {
background-color: black;
background-color: var(--theme);
color: var(--white);
border: none;
}
Expand Down
36 changes: 22 additions & 14 deletions frontend/src/components/AppNavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
<router-link class="link-item" to="/">
<AppLogo :first="'S'" :last="'C'"/>
</router-link>
<!-- global loading state -->
<!--LoadingSpinner style="height:50px;width:auto;margin:10px;" v-if="loading" /-->
</div>

<div class="links">
<Search class="mini" v-if="$route.name !== 'home'"/>
<!-- hacky padding div -->
<div v-else/>
<h3 v-if="!isFirebaseAuthorised"><router-link class="link-item" to="/login">Login</router-link></h3>
<h3 v-if="!isFirebaseAuthorised"><router-link class="link-item" to="/signup">Sign Up</router-link></h3>
<h3 v-if="isFirebaseAuthorised && !hasProfile"><router-link class="link-item" to="/create-profile">Profile</router-link></h3>
<h3 v-if="isLoggedIn"><router-link class="link-item" to="/profile">Profile</router-link></h3>
<h3 v-if="isFirebaseAuthorised" @click="logout()" class="link-item">Logout</h3>
<Search class="mini" v-if="$route.name !== 'home' && $route.name !== 'subjectList'"/>
<div class="nav-menu">
<div class="menu-items">
<router-link tag="h3" v-if="!isFirebaseAuthorised" class="link-item" to="/login">Login</router-link>
<router-link tag="h3" v-if="!isFirebaseAuthorised" class="link-item" to="/signup">Sign Up</router-link>
<router-link tag="h3" v-if="isFirebaseAuthorised && !hasProfile" class="link-item" to="/create-profile">Profile</router-link>
<router-link tag="h3" v-if="isLoggedIn" class="link-item" to="/profile">Profile</router-link>
<h3 v-if="isFirebaseAuthorised" @click="logout()" class="link-item">Logout</h3>
</div>
</div>
</div>
</div>
</template>

<script>
import Search from '@/components/AppSearch'
import Search from '@/components/Search'
import { mapGetters } from 'vuex'
export default {
Expand All @@ -42,17 +42,20 @@ export default {

<style lang="less" scoped>
#nav {
#nav, .menu-items, .nav-menu {
display: flex;
padding: 0px 20px;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-bottom: var(--border);
background-color: var(--white);
font-size: var(--font-small);
}
#nav {
padding: 0px 20px;
border-bottom: var(--border);
}
.logo-span {
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -81,5 +84,10 @@ export default {
#nav {
font-size: var(--font-small-mobile);
}
.menu-items .link-item {
font: var(--header-4-mobile);
}
}
</style>
10 changes: 7 additions & 3 deletions frontend/src/components/AppPageSelector.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div class="PageSelector">
<div class="PageSelector" v-if="lastPage">
<div class='button-container'>
<AppButton @click.native="goPrevPage()" :alt="false">&laquo;</AppButton>
<AppButton :disabled="true">{{currPage}}</AppButton>
<AppButton disabled="true">{{currPage}}</AppButton>
<AppButton @click.native="goNextPage()" :alt="false">&raquo;</AppButton>
</div>
</div>
Expand Down Expand Up @@ -42,9 +42,13 @@ export default {
}
</script>

<style>
<style scoped>
.button-container {
padding: 10px 0;
text-align:center;
}
.button-container > button {
margin: 5px;
}
</style>
2 changes: 1 addition & 1 deletion frontend/src/components/Authentication/Form.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="app-auth-form">
<div class="app-auth-form" @keyup.enter="clickHandler">
<Card>
<div class="card-content">
<h2 v-if="title">{{ title }}</h2>
Expand Down
28 changes: 28 additions & 0 deletions frontend/src/components/Card/Form.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<Card>
<div class="content">
<CardHeader>{{ title }}</CardHeader>
<form>
<slot/>
</form>
</div>
</Card>
</template>

<script>
import Card from '@/components/Card'
import CardHeader from '@/components/Card/Header'
export default {
components: { Card, CardHeader },
props: {
title: String
}
}
</script>

<style scoped>
.content {
padding: 10px 20px;
}
</style>
55 changes: 55 additions & 0 deletions frontend/src/components/Card/Large.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<template>
<Card>
<!-- Add badges here in future -->
<CardHeader v-if="title">{{ title }}</CardHeader>
<!-- User block -->
<User v-bind="user" :published="published"/>
<!-- Content block and user interaction -->
<div class="content">
<Vote v-bind="vote" />
<p>{{ body }}</p>
</div>
</Card>
</template>

<script>
import Card from '.'
import CardHeader from './Header'
import User from '@/components/User/Summary'
import Vote from '@/components/Vote'
export default {
components: {
Card,
CardHeader,
User,
Vote
},
props: {
/* post title */
title: String,
/* post body */
body: String,
/* post vote object, verify at lower level */
vote: Object,
/* user object, verify at lower level */
user: Object,
/* Date string */
published: String
}
}
</script>

<style scoped>
.content {
display: grid;
grid-template-columns: 45px auto;
grid-gap: 10px;
}
p {
margin: 10px 0;
font: var(--body-copy-2);
padding: 5px;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
<template>
<Card>
<div class="card-content">
<Vote v-bind:likes="comment.likes" :upvote="upvote" :downvote="downvote" />
<div class="content">
<p>{{ comment.body }}</p>
</div>
<aside class="user">
<User :image="'https://travis-ci.com/images/logos/TravisCI-Mascot-3.png'"/>
<!-- Fix me later -->
<p class="date">Posted: <time>{{ comment.published }}</time></p>
</aside>
</div>
</Card>
<PostCard
:published="comment.published"
:body="comment.body"
:vote="{ upvote, downvote, likes: comment.likes }"
:user="{ userID: comment.author }"
>
</PostCard>
</template>

<script>
import Card from '@/components/Card'
import User from '@/components/User'
import Vote from '@/components/Vote'
import PostCard from '@/components/Card/Large'
export default {
components: { Card, User, Vote },
components: { PostCard },
props: {
type: String,
id: String,
Expand Down Expand Up @@ -51,6 +43,3 @@ export default {
}
}
</script>

<style scoped src='../../css/card.less' lang='less'>
</style>
31 changes: 31 additions & 0 deletions frontend/src/components/Comments/CommentForm.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<CardForm :title="`Submit ${type}`">
<textarea placeholder="Your input here.." v-model="body"></textarea><br>
<!-- should probs be a separate component -->
<AppButton @click.native="callback({body}); body=''">{{ type }}</AppButton>
<!-- errors will be injected here -->
<slot></slot>
</CardForm>
</template>

<script>
import CardForm from '@/components/Card/Form'
import AppButton from '@/components/AppButton'
export default {
name: 'CommentForm',
components: {
CardForm,
AppButton
},
props: {
type: String,
callback: Function
},
data () {
return {
body: ''
}
}
}
</script>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
</template>

<script>
import FeedCard from '@/components/course/FeedCard'
import FeedCard from '@/components/Course/FeedCard'
export default {
name: 'Feed',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<b>{{ positiveOrNegativeText }}</b>
</p>
<p v-else>
<b>Know the answer to this question?</b>
Know the answer to this question?
</p>
<p class="likes">{{ likes || 0 }} users found this helpful</p>
</div>
Expand All @@ -31,12 +31,8 @@ export default {
author: Number,
code: String,
id: String,
cardType: String
},
data() {
return {
randomNumber: Math.random()
}
cardType: String,
recommend: Number
},
components: {
Card,
Expand All @@ -45,10 +41,10 @@ export default {
computed: {
/* TODO use recommendation */
positiveOrNegativeText() {
return this.randomNumber > 0.5 ? 'Recommended' : 'Not Recommended'
return this.recommend ? 'Recommended' : 'Not Recommended'
},
positiveOrNegativeClass() {
return this.randomNumber > 0.5 ? 'positive' : 'negative'
return this.recommend ? 'positive' : 'negative'
},
routeName() {
return this.cardType === 'Review' ? 'review' : 'question'
Expand Down Expand Up @@ -112,6 +108,11 @@ p {
.likes {
display: none;
}
h3 {
font: var(--header-4-mobile);
font-weight: bolder;
}
}
</style>
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit aa2e6e8

Please sign in to comment.