Various minor style improvements

This commit is contained in:
Riccardo Graziosi
2022-04-07 18:58:18 +02:00
parent 1943b8446f
commit ad67c3986b
17 changed files with 42 additions and 27 deletions

View File

@@ -2,7 +2,7 @@ import * as React from 'react';
import PostStatusListItem from './PostStatusListItem'; import PostStatusListItem from './PostStatusListItem';
import Spinner from '../shared/Spinner'; import Spinner from '../shared/Spinner';
import { TitleText, DangerText } from '../shared/CustomTexts'; import { BoxTitleText, DangerText } from '../shared/CustomTexts';
import IPostStatus from '../../interfaces/IPostStatus'; import IPostStatus from '../../interfaces/IPostStatus';
@@ -24,7 +24,7 @@ const PostStatusFilter = ({
currentFilter, currentFilter,
}: Props) => ( }: Props) => (
<div className="postStatusFilterContainer sidebarCard"> <div className="postStatusFilterContainer sidebarCard">
<TitleText>Filter by post status</TitleText> <BoxTitleText>Filter by status</BoxTitleText>
{ {
postStatuses.map((postStatus, i) => ( postStatuses.map((postStatus, i) => (
<PostStatusListItem <PostStatusListItem

View File

@@ -1,6 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import { TitleText } from '../shared/CustomTexts'; import { BoxTitleText } from '../shared/CustomTexts';
interface Props { interface Props {
searchQuery: string; searchQuery: string;
@@ -9,7 +9,8 @@ interface Props {
const SearchFilter = ({ searchQuery, handleChange }: Props) => ( const SearchFilter = ({ searchQuery, handleChange }: Props) => (
<div className="sidebarCard"> <div className="sidebarCard">
<TitleText>Search</TitleText> <BoxTitleText>Search</BoxTitleText>
<input <input
type="search" type="search"
value={searchQuery} value={searchQuery}

View File

@@ -43,7 +43,7 @@ const NewComment = ({
<Button <Button
onClick={() => handleSubmit(body, parentId)} onClick={() => handleSubmit(body, parentId)}
className="submitCommentButton"> className="submitCommentButton">
{ isSubmitting ? <Spinner /> : 'Submit' } { isSubmitting ? <Spinner color="light" /> : 'Submit' }
</Button> </Button>
</React.Fragment> </React.Fragment>
: :

View File

@@ -4,7 +4,7 @@ import Gravatar from 'react-gravatar';
import ILike from '../../interfaces/ILike'; import ILike from '../../interfaces/ILike';
import Spinner from '../shared/Spinner'; import Spinner from '../shared/Spinner';
import { import {
TitleText, BoxTitleText,
DangerText, DangerText,
CenteredMutedText CenteredMutedText
} from '../shared/CustomTexts'; } from '../shared/CustomTexts';
@@ -17,7 +17,7 @@ interface Props {
const LikeList = ({ likes, areLoading, error}: Props) => ( const LikeList = ({ likes, areLoading, error}: Props) => (
<div className="likeListContainer"> <div className="likeListContainer">
<TitleText>People who liked</TitleText> <BoxTitleText>Likes</BoxTitleText>
{ areLoading ? <Spinner /> : null } { areLoading ? <Spinner /> : null }
{ error ? <DangerText>{error}</DangerText> : null } { error ? <DangerText>{error}</DangerText> : null }
<div className="likeList"> <div className="likeList">

View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import Gravatar from 'react-gravatar'; import Gravatar from 'react-gravatar';
import { TitleText, DangerText, CenteredMutedText, MutedText } from '../shared/CustomTexts'; import { BoxTitleText, DangerText, CenteredMutedText, MutedText } from '../shared/CustomTexts';
import Spinner from '../shared/Spinner'; import Spinner from '../shared/Spinner';
import IComment from '../../interfaces/IComment'; import IComment from '../../interfaces/IComment';
@@ -20,11 +20,11 @@ const PostUpdateList = ({
error, error,
}: Props) => ( }: Props) => (
<div className="postUpdateListContainer"> <div className="postUpdateListContainer">
<TitleText>Post updates</TitleText> <BoxTitleText>Updates</BoxTitleText>
{ areLoading ? <Spinner /> : null } { areLoading ? <Spinner /> : null }
{ error ? <DangerText>{error}</DangerText> : null } { error ? <DangerText>{error}</DangerText> : null }
<div className="postUpdateList"> <div className="postUpdateList">
{ postUpdates.length === 0 ? <CenteredMutedText>There are no post updates yet.</CenteredMutedText> : null } { postUpdates.length === 0 ? <CenteredMutedText>There are no updates yet.</CenteredMutedText> : null }
{ {
postUpdates.map((postUpdate, i) => ( postUpdates.map((postUpdate, i) => (
<div className="postUpdateListItem" key={i}> <div className="postUpdateListItem" key={i}>

View File

@@ -13,6 +13,10 @@ export const TitleText = ({ children }: Props) => (
<span className="titleText">{children}</span> <span className="titleText">{children}</span>
); );
export const BoxTitleText = ({ children }: Props) => (
<span className="boxTitleText">{children}</span>
);
export const MutedText = ({ children }: Props) => ( export const MutedText = ({ children }: Props) => (
<span className="mutedText">{children}</span> <span className="mutedText">{children}</span>
); );

View File

@@ -3,7 +3,7 @@ import * as React from 'react';
import IBoard from '../../interfaces/IBoard'; import IBoard from '../../interfaces/IBoard';
const PostBoardLabel = ({ name }: IBoard) => ( const PostBoardLabel = ({ name }: IBoard) => (
<span className="badge badgeLight">{name}</span> <span className="badge badgeLight">{name?.toUpperCase()}</span>
); );
export default PostBoardLabel; export default PostBoardLabel;

View File

@@ -9,7 +9,9 @@ const PostStatusLabel = ({
name, name,
color, color,
}: Props) => ( }: Props) => (
<span className="badge" style={{backgroundColor: color, color: 'white'}}>{name}</span> <span className="badge" style={{backgroundColor: color, color: 'white'}}>
{name?.toUpperCase()}
</span>
); );
export default PostStatusLabel; export default PostStatusLabel;

View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
const Spinner = () => ( const Spinner = ({ color = 'dark' }) => (
<div className="spinner-grow d-block mx-auto" role="status"> <div className={`spinner-grow d-block mx-auto text-${color}`} role="status">
<span className="sr-only">Loading...</span> <span className="sr-only">Loading...</span>
</div> </div>
); );

View File

@@ -124,5 +124,4 @@
.postTitle { .postTitle {
color: white; color: white;
} }
} }

View File

@@ -30,6 +30,8 @@
@extend @extend
.align-self-end; .align-self-end;
box-sizing: border-box;
width: 120px;
height: 40px; height: 40px;
} }
} }
@@ -90,5 +92,4 @@
.commentList .comment .commentFooter .commentLink { .commentList .comment .commentFooter .commentLink {
color: white; color: white;
} }
} }

View File

@@ -121,7 +121,6 @@
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
.postDescription { .postDescription {
color: white !important; color: white !important;
} }
@@ -138,6 +137,4 @@
.postAndCommentsContainer .postHeader a { .postAndCommentsContainer .postHeader a {
color: white; color: white;
} }
} }

View File

@@ -88,5 +88,4 @@ a {
background-color: #E74C3C; background-color: #E74C3C;
border-color: #fff; border-color: #fff;
} }
} }

View File

@@ -8,6 +8,15 @@
.font-weight-bolder; .font-weight-bolder;
} }
.boxTitleText {
@extend
.font-weight-bolder,
.text-uppercase,
.mb-2;
font-size: 16px;
}
.centeredText { .centeredText {
@extend @extend
.text-center, .text-center,

View File

@@ -36,6 +36,11 @@
a { color: $astuto-black; } a { color: $astuto-black; }
} }
.switch {
@extend
.custom-control-input;
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
.deviseLinks { .deviseLinks {
a { color: white; } a { color: white; }

View File

@@ -17,8 +17,11 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label :notifications_enabled %> <%= f.label :notifications_enabled %> <br />
<%= f.check_box :notifications_enabled %> <%= f.check_box :notifications_enabled, style: "transform: scale(1.5)" %>
<small id="notificationsHelp" class="form-text text-muted">
if disabled, you won't receive any notification
</small>
</div> </div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>

View File

@@ -23,11 +23,6 @@
<%= f.password_field :password_confirmation, placeholder: "Password confirmation", required: true, class: "form-control" %> <%= f.password_field :password_confirmation, placeholder: "Password confirmation", required: true, class: "form-control" %>
</div> </div>
<div class="form-group">
<%= f.label :notifications_enabled %>
<%= f.check_box :notifications_enabled %>
</div>
<div class="actions"> <div class="actions">
<%= f.submit "Sign up", class: "btn btn-block" %> <%= f.submit "Sign up", class: "btn btn-block" %>
</div> </div>