Improve style pt. 1

This commit is contained in:
riggraz
2019-09-19 16:42:43 +02:00
parent 2b1fc213db
commit 409cdeef8a
19 changed files with 157 additions and 62 deletions

View File

@@ -142,8 +142,8 @@ class NewPost extends React.Component<Props, State> {
return ( return (
<div className="newBoardContainer sidebarBox"> <div className="newBoardContainer sidebarBox">
<TitleText>{board.name}</TitleText> <span className="boardTitle">{board.name}</span>
<MutedText>{board.description}</MutedText> <p><MutedText>{board.description}</MutedText></p>
{ {
isLoggedIn ? isLoggedIn ?
<Button <Button

View File

@@ -6,7 +6,7 @@ import PostListItem from './PostListItem';
import Spinner from '../shared/Spinner'; import Spinner from '../shared/Spinner';
import { import {
DangerText, DangerText,
MutedText, CenteredMutedText,
} from '../shared/CustomTexts'; } from '../shared/CustomTexts';
import IPost from '../../interfaces/IPost'; import IPost from '../../interfaces/IPost';
@@ -55,10 +55,7 @@ const PostList = ({
/> />
)) ))
: :
areLoading ? areLoading ? <p></p> : <CenteredMutedText>There are no posts.</CenteredMutedText>
<MutedText>Loading...</MutedText>
:
<MutedText>There are no posts.</MutedText>
} }
</InfiniteScroll> </InfiniteScroll>
</div> </div>

View File

@@ -16,7 +16,7 @@ interface Props {
const PostListItem = ({ id, title, description, postStatus}: Props) => ( const PostListItem = ({ id, title, description, postStatus}: Props) => (
<a href={`/posts/${id}`} className="postLink"> <a href={`/posts/${id}`} className="postLink">
<div className="postListItem"> <div className="postListItem">
<TitleText>{title}</TitleText> <span className="postTitle">{title}</span>
<DescriptionText limit={120}>{description}</DescriptionText> <DescriptionText limit={120}>{description}</DescriptionText>
<div className="postDetails"> <div className="postDetails">

View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import PostListItem from './PostListItem'; import PostListItem from './PostListItem';
import { MutedText } from '../shared/CustomTexts'; import { CenteredMutedText } from '../shared/CustomTexts';
import IPostJSON from '../../interfaces/json/IPost'; import IPostJSON from '../../interfaces/json/IPost';
import IBoard from '../../interfaces/IBoard'; import IBoard from '../../interfaces/IBoard';
@@ -25,7 +25,7 @@ const PostList = ({ posts, boards }: Props) => (
/> />
)) ))
: :
<MutedText>There are no posts that have this status.</MutedText> <CenteredMutedText>There are no posts that have this status.</CenteredMutedText>
} }
</div> </div>
); );

View File

@@ -14,10 +14,9 @@ interface Props {
} }
const PostListByPostStatus = ({ postStatus, posts, boards }: Props) => ( const PostListByPostStatus = ({ postStatus, posts, boards }: Props) => (
<div className="roadmapColumn" style={{borderColor: postStatus.color}}> <div className="roadmapColumn">
<div className="columnHeader" <div className="columnHeader"
style={{borderBottomColor: postStatus.color}}> style={{backgroundColor: postStatus.color}}>
<div className="dot" style={{backgroundColor: postStatus.color}}></div>
<div className="columnTitle"><TitleText>{postStatus.name}</TitleText></div> <div className="columnTitle"><TitleText>{postStatus.name}</TitleText></div>
</div> </div>
<div className="scrollContainer"> <div className="scrollContainer">

View File

@@ -11,7 +11,7 @@ interface Props {
const Button = ({ children, onClick, className = '', outline = false}: Props) => ( const Button = ({ children, onClick, className = '', outline = false}: Props) => (
<button <button
onClick={onClick} onClick={onClick}
className={`${className} btn btn-${outline ? 'outline-' : ''}dark my-2`} className={`${className} btn btn-${outline ? 'outline-' : ''}dark`}
> >
{children} {children}
</button> </button>

View File

@@ -5,10 +5,7 @@ interface Props {
} }
const CommentsNumber = ({ number }: Props) => ( const CommentsNumber = ({ number }: Props) => (
<div className="d-flex"> <span className="badge badgeLight">{`${number} comment${number === 1 ? '' : 's'}`}</span>
<span className="comment icon"></span>
<span>{`${number} comment${number === 1 ? '' : 's'}`}</span>
</div>
); );
export default CommentsNumber; export default CommentsNumber;

View File

@@ -17,6 +17,10 @@ export const MutedText = ({ children }: Props) => (
<span className="mutedText">{children}</span> <span className="mutedText">{children}</span>
); );
export const CenteredMutedText = ({ children }: Props) => (
<p className="centeredText"><span className="mutedText">{children}</span></p>
);
export const UppercaseText = ({ children }: Props) => ( export const UppercaseText = ({ children }: Props) => (
<span className="uppercaseText">{children}</span> <span className="uppercaseText">{children}</span>
); );

View File

@@ -7,10 +7,7 @@ const PostStatusLabel = ({
name, name,
color, color,
}: IPostStatus) => ( }: IPostStatus) => (
<div style={{display: 'flex'}}> <span className="badge" style={{backgroundColor: color, color: 'white'}}>{name}</span>
<div className="dot" style={{backgroundColor: color}}></div>
<span className="postStatusName">{name}</span>
</div>
); );
export default PostStatusLabel; export default PostStatusLabel;

View File

@@ -8,10 +8,11 @@
.sidebar { .sidebar {
position: sticky; position: sticky;
top: 20px; top: 60px;
.sidebarBox { .sidebarBox {
width: 250px; width: 250px;
margin-right: 16px;
} }
} }
@@ -29,20 +30,27 @@
} }
} }
.newBoardContainer {
background-color: $astuto-grey;
text-align: center;
.boardTitle {
font-size: 25px;
font-weight: 600;
}
}
.sidebarBox { .sidebarBox {
@extend @extend
.card,
.d-flex, .d-flex,
.flex-column, .flex-column,
.justify-content-start, .justify-content-start,
.align-items-center, .align-items-center,
.flex-grow-0, .flex-grow-0,
.flex-shrink-0; .flex-shrink-0,
.my-3,
border: thin solid black; .p-2;
border-radius: 4px;
margin: 8px;
padding: 8px;
} }
.postStatusListItemContainer { .postStatusListItemContainer {
@@ -63,10 +71,12 @@
height: 40px; height: 40px;
&:hover { &:hover {
filter: brightness(90%);
cursor: pointer; cursor: pointer;
}
background-color: #f5f5f5; span.badge {
border-radius: 4px; display: block; font-size: 15px;
} }
} }
@@ -74,6 +84,7 @@
@extend @extend
.flex-grow-0, .flex-grow-0,
.flex-shrink-0, .flex-shrink-0,
.rounded-circle,
.align-self-center, .align-self-center,
.p-0; .p-0;
@@ -89,33 +100,38 @@
} }
.postLink { .postLink {
@extend .my-3;
display: block; display: block;
border-radius: 4px;
margin: 8px 0;
color: black; color: black;
&:hover { &:hover { text-decoration: none; }
text-decoration: none;
background-color: #f5f5f5;
}
} }
.postListItem { .postListItem {
@extend @extend
.card3D,
.d-flex, .d-flex,
.flex-column, .flex-column,
.justify-content-between, .justify-content-between,
.m-0, .p-3;
.px-2,
.py-1;
height: 114px; height: 140px;
}
.postTitle {
@extend
.font-weight-bold;
} }
.postDetails { .postDetails {
@extend @extend
.d-flex, .d-flex,
.justify-content-between, .justify-content-start,
.text-uppercase; .text-uppercase;
.badge {
@extend .mr-2;
}
} }
} }

View File

@@ -8,9 +8,10 @@
@extend @extend
.card, .card,
.my-2, .my-2,
.px-2; .p-0;
width: 32%; width: 32%;
background-color: $astuto-grey;
@media (max-width: 800px) { @media (max-width: 800px) {
width: 100%; width: 100%;
@@ -20,27 +21,31 @@
.columnHeader { .columnHeader {
@extend @extend
.card-header, .card-header,
.d-flex, .d-flex;
.bg-transparent;
.columnTitle {
color: white;
}
} }
.scrollContainer { .scrollContainer {
@extend
.card-body;
overflow-y: auto; overflow-y: auto;
max-height: 350px; max-height: 350px;
} }
.postLink:hover { .postLink {
text-decoration: none; @extend
.my-2;
&:hover { text-decoration: none; }
} }
.postListItem { .postListItem {
@extend @extend
.card3D,
.d-flex, .d-flex,
.flex-column, .flex-column,
.my-1, .m-2,
.py-2; .py-2;
} }
} }

View File

@@ -0,0 +1,2 @@
$astuto-grey: rgba(178, 178, 178, 0.15);
$muted-text-color: #6c757d;

View File

@@ -0,0 +1,37 @@
.card {
@extend .card;
box-shadow: 0 1px 1px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.15);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
color: #333;
padding: 8px;
}
.card3D {
@extend
.card;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
&:hover {
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
}
.badge {
@extend
.badge,
.badge-pill,
.p-2;
font-size: 13px;
}
.badgeLight {
@extend .badge-light;
background-color: $astuto-grey;
}

View File

@@ -5,14 +5,17 @@
.titleText { .titleText {
@extend @extend
.text-dark,
.font-weight-bolder; .font-weight-bolder;
} }
.mutedText { .centeredText {
@extend @extend
.text-muted, .text-center,
.text-center; .p-2;
}
.mutedText {
color: $muted-text-color;
} }
.uppercaseText { .uppercaseText {
@@ -20,6 +23,8 @@
.text-secondary, .text-secondary,
.text-uppercase, .text-uppercase,
.font-weight-lighter; .font-weight-lighter;
font-size: 13px;
} }
.successText { .successText {

View File

@@ -1,5 +1,3 @@
@import "node_modules/bootstrap/scss/variables";
.field_with_errors { .field_with_errors {
label { label {
color: $danger; color: $danger;
@@ -9,3 +7,8 @@
border-color: $danger; border-color: $danger;
} }
} }
.form-control:focus {
border-color: $astuto-grey;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(0, 0, 0, 0.6);
}

View File

@@ -1,15 +1,44 @@
.navbar { .navbar {
position: sticky;
z-index: 1;
top: 0px;
background-color: white;
border-bottom-width: 1px; border-bottom-width: 1px;
border-bottom-style: solid; border-bottom-style: solid;
border-bottom-color: black; border-bottom-color: rgba(0, 0, 0, 0.25);
margin-bottom: 1.5em; box-shadow: 0 1px 4px rgba(0,0,0,0.15), 0 1px 8px rgba(0,0,0,0.15);
margin-bottom: 1em;
.navbar-brand { .navbar-brand {
font-size: 18pt; font-size: 18pt;
font-weight: 700; font-weight: 700;
} }
.boardsNav {
@extend
.navbar-nav,
.nav-pills,
.d-flex,
.flex-row,
.mr-auto;
.nav-item {
@extend
.badge,
.text-uppercase;
a { @extend .text-dark; }
}
.nav-item.active {
@extend .badgeLight;
}
}
.fullname { .fullname {
vertical-align: middle; vertical-align: middle;

View File

@@ -1,5 +1,8 @@
@import 'vendors/bootstrap_custom'; @import 'vendors/bootstrap_custom';
@import 'constants/colors';
@import 'general/components';
@import 'general/custom_texts'; @import 'general/custom_texts';
@import 'general/form'; @import 'general/form';
@import 'general/icons'; @import 'general/icons';

View File

@@ -6,12 +6,12 @@
</button> </button>
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav nav-pills mr-auto"> <ul class="boardsNav">
<%= render 'layouts/boards_menu_section', boards: @boards unless @boards.nil? %> <%= render 'layouts/boards_menu_section', boards: @boards unless @boards.nil? %>
</ul> </ul>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<% if user_signed_in? %> <% if user_signed_in? %>
<% if current_user.moderator? || current_user.admin? %> <% if current_user.power_user? %>
<li class="nav-item"> <li class="nav-item">
<%= link_to 'Admin Panel', admin_root_path, class: 'nav-link', 'data-turbolinks': 'false' %> <%= link_to 'Admin Panel', admin_root_path, class: 'nav-link', 'data-turbolinks': 'false' %>
</li> </li>

View File

@@ -5,6 +5,7 @@
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="turbolinks-cache-control" content="no-cache"> <meta name="turbolinks-cache-control" content="no-cache">
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>