diff --git a/app/javascript/components/Board/BoardP.tsx b/app/javascript/components/Board/BoardP.tsx index 708fe837..923940da 100644 --- a/app/javascript/components/Board/BoardP.tsx +++ b/app/javascript/components/Board/BoardP.tsx @@ -74,7 +74,7 @@ class BoardP extends React.Component { const { filters } = posts; return ( -
+
{ } = this.state; return ( -
- {board.name} - {board.description} +
+ {board.name} + {board.description} { isLoggedIn ? : @@ -164,8 +170,8 @@ class NewPost extends React.Component { } { isLoading ? : null } - { error ? {error} : null } - { success ? {success} : null } + { error ? {error} : null } + { success ? {success} : null }
); } diff --git a/app/javascript/components/Board/PostList.tsx b/app/javascript/components/Board/PostList.tsx index 694c9f73..48972c9d 100644 --- a/app/javascript/components/Board/PostList.tsx +++ b/app/javascript/components/Board/PostList.tsx @@ -4,6 +4,10 @@ import InfiniteScroll from 'react-infinite-scroller'; import PostListItem from './PostListItem'; import Spinner from '../shared/Spinner'; +import { + DangerText, + MutedText, +} from '../shared/CustomTexts'; import IPost from '../../interfaces/IPost'; import IPostStatus from '../../interfaces/IPostStatus'; @@ -28,8 +32,8 @@ const PostList = ({ page, hasMore }: Props) => ( -
- { error ? {error} : null } +
+ { error ? {error} : null } Loading... + Loading... : - There are no posts. + There are no posts. }
diff --git a/app/javascript/components/Board/PostListItem.tsx b/app/javascript/components/Board/PostListItem.tsx index d2bed224..ebb660b4 100644 --- a/app/javascript/components/Board/PostListItem.tsx +++ b/app/javascript/components/Board/PostListItem.tsx @@ -1,6 +1,8 @@ import * as React from 'react'; +import CommentsNumber from '../shared/CommentsNumber'; import PostStatusLabel from '../shared/PostStatusLabel'; +import { TitleText, DescriptionText } from '../shared/CustomTexts'; import IPostStatus from '../../interfaces/IPostStatus'; @@ -13,21 +15,12 @@ interface Props { const PostListItem = ({ id, title, description, postStatus}: Props) => ( -
-
{title}
-
- { - description && description.length > 120 ? - description.slice(0, 119) + '...' - : - description || '' - } -
-
-
- - 0 comments -
+
+ {title} + {description} + +
+ { postStatus ? : null }
diff --git a/app/javascript/components/Board/PostStatusFilter.tsx b/app/javascript/components/Board/PostStatusFilter.tsx index 9c56bf21..1850f855 100644 --- a/app/javascript/components/Board/PostStatusFilter.tsx +++ b/app/javascript/components/Board/PostStatusFilter.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import PostStatusListItem from './PostStatusListItem'; import Spinner from '../shared/Spinner'; +import { TitleText, DangerText } from '../shared/CustomTexts'; import IPostStatus from '../../interfaces/IPostStatus'; @@ -22,8 +23,8 @@ const PostStatusFilter = ({ handleFilterClick, currentFilter, }: Props) => ( -
- Filter by post status: +
+ Filter by post status: { postStatuses.map((postStatus, i) => ( : null } - { error ? {error} : null } + { error ? {error} : null }
); diff --git a/app/javascript/components/Board/PostStatusListItem.tsx b/app/javascript/components/Board/PostStatusListItem.tsx index e793cec6..9025643d 100644 --- a/app/javascript/components/Board/PostStatusListItem.tsx +++ b/app/javascript/components/Board/PostStatusListItem.tsx @@ -18,15 +18,20 @@ const PostStatusListItem = ({ isCurrentFilter, handleResetFilter, }: Props) => ( -
- -
+
+ +
{ isCurrentFilter ? - : null + + : + null }
); diff --git a/app/javascript/components/Board/SearchFilter.tsx b/app/javascript/components/Board/SearchFilter.tsx index bd62d17f..8d05759c 100644 --- a/app/javascript/components/Board/SearchFilter.tsx +++ b/app/javascript/components/Board/SearchFilter.tsx @@ -1,13 +1,15 @@ import * as React from 'react'; +import { TitleText } from '../shared/CustomTexts'; + interface Props { searchQuery: string; handleChange(newSearchQuery: string): void; } const SearchFilter = ({ searchQuery, handleChange }: Props) => ( -
- +
+ Search: handleChange(e.target.value)} diff --git a/app/javascript/components/Roadmap/PostList.tsx b/app/javascript/components/Roadmap/PostList.tsx index 752a4a7b..e54fc6e4 100644 --- a/app/javascript/components/Roadmap/PostList.tsx +++ b/app/javascript/components/Roadmap/PostList.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import PostListItem from './PostListItem'; +import { MutedText } from '../shared/CustomTexts'; import IPostJSON from '../../interfaces/json/IPost'; import IBoard from '../../interfaces/IBoard'; @@ -24,7 +25,7 @@ const PostList = ({ posts, boards }: Props) => ( /> )) : - There are no posts that have this status. + There are no posts that have this status. }
); diff --git a/app/javascript/components/Roadmap/PostListByPostStatus.tsx b/app/javascript/components/Roadmap/PostListByPostStatus.tsx index 9974507b..00c479eb 100644 --- a/app/javascript/components/Roadmap/PostListByPostStatus.tsx +++ b/app/javascript/components/Roadmap/PostListByPostStatus.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import PostList from './PostList'; +import { TitleText } from '../shared/CustomTexts'; import IPostStatus from '../../interfaces/IPostStatus'; import IPostJSON from '../../interfaces/json/IPost'; @@ -13,12 +14,13 @@ interface Props { } const PostListByPostStatus = ({ postStatus, posts, boards }: Props) => ( -
-
+
+
-
{postStatus.name}
+
{postStatus.name}
-
+
( -
-
{title}
-
{boardName}
+
+ {title} + {boardName}
); diff --git a/app/javascript/components/Roadmap/index.tsx b/app/javascript/components/Roadmap/index.tsx index 0e1f5fe8..8c8f263b 100644 --- a/app/javascript/components/Roadmap/index.tsx +++ b/app/javascript/components/Roadmap/index.tsx @@ -19,7 +19,7 @@ class Roadmap extends React.Component { const { postStatuses, posts, boards } = this.props; return ( -
+
{postStatuses.map((postStatus, i) => ( { } } -export default Roadmap; +export default Roadmap; \ No newline at end of file diff --git a/app/javascript/components/shared/CommentsNumber.tsx b/app/javascript/components/shared/CommentsNumber.tsx new file mode 100644 index 00000000..fbf3a497 --- /dev/null +++ b/app/javascript/components/shared/CommentsNumber.tsx @@ -0,0 +1,14 @@ +import * as React from 'react'; + +interface Props { + number: number; +} + +const CommentsNumber = ({ number }: Props) => ( +
+ + {`${number} comment${number === 1 ? '' : 's'}`} +
+); + +export default CommentsNumber; \ No newline at end of file diff --git a/app/javascript/components/shared/CustomTexts.tsx b/app/javascript/components/shared/CustomTexts.tsx new file mode 100644 index 00000000..5d8c17af --- /dev/null +++ b/app/javascript/components/shared/CustomTexts.tsx @@ -0,0 +1,41 @@ +import * as React from 'react'; + +interface Props { + children: string; +} + +interface DescriptionTextProps { + children: string; + limit?: number; +} + +export const TitleText = ({ children }: Props) => ( + {children} +); + +export const MutedText = ({ children }: Props) => ( + {children} +); + +export const UppercaseText = ({ children }: Props) => ( + {children} +); + +export const SuccessText = ({ children }: Props) => ( + {children} +); + +export const DangerText = ({ children }: Props) => ( + {children} +); + +export const DescriptionText = ({ children, limit = 90}: DescriptionTextProps) => ( + + { + children && children.length > limit ? + children.slice(0, limit-1) + '...' + : + children || '' + } + +); \ No newline at end of file diff --git a/app/javascript/stylesheets/components/Board.scss b/app/javascript/stylesheets/components/Board.scss index a6be7ec9..bb1ef259 100644 --- a/app/javascript/stylesheets/components/Board.scss +++ b/app/javascript/stylesheets/components/Board.scss @@ -1,5 +1,5 @@ -@media (max-width: 800px) { - .boardContainer { +.boardContainer { + @media (max-width: 800px) { flex-direction: column; .sidebar { @@ -7,200 +7,74 @@ width: 100%; top: 0; - .sidebar-box { + .sidebarBox { width: 100%; } } - - .box { - width: 100%; - } } -} -@media (min-width: 801px) { - .boardContainer { + @media (min-width: 801px) { flex-direction: row; .sidebar { position: sticky; top: 20px; - .sidebar-box { + .sidebarBox { width: 250px; } } } -} -.boardContainer { - display: flex; - flex: 1 1 auto; - justify-content: space-between; - align-items: flex-start; - flex-wrap: nowrap; - - .sidebar { - .sidebar-box { - flex: 0 0 auto; - - display: flex; - flex-direction: column; - justify-content: flex-start; - align-items: center; - } - } + .sidebarBox { + flex: 0 0 auto; - .box { - border: 1px solid black; + display: flex; + flex-direction: column; + justify-content: flex-start; + align-items: center; + + border: thin solid black; border-radius: 4px; - - padding: 8px; + margin: 8px; - - .smallTitle { - font-size: 19px; - font-weight: 600; - } + padding: 8px; } - .newBoardContainer { - .boardName { - font-size: 24px; - font-weight: 600; - - text-align: center; - } - - .boardDescription { - color: grey; - font-size: 17px; - font-weight: 200; - - text-align: center; - - margin-bottom: 8px; - } - - .submitBtn { - margin-bottom: 8px; - } - - .success { - color: green; - text-align: center; - } - - .error { - color: red; - text-align: center; - } - } + .postStatusListItem { + height: 40px; - .postStatusFilterContainer { - .postStatusListItemContainer { - display: flex; - - flex: 1 1 auto; - align-self: stretch; - } - - .postStatusListItemLink { - flex: 1 1 auto; - } - - .postStatusListItem { - height: 40px; - - display: flex; - align-items: center; - - font-size: 17px; - font-weight: 500; - - padding: 4px; - } - - .postStatusListItem:hover { + &:hover { cursor: pointer; background-color: #f5f5f5; border-radius: 4px; } + } - .resetFilter { - flex: 0 0 auto; - width: 30px; - height: 30px; + .resetFilter { + flex: 0 0 auto; + width: 30px; + height: 30px; - padding: 0; + padding: 0; - align-self: center; - } + align-self: center; + } + + .postLink { + display: block; + border-radius: 4px; + margin: 8px 0; + color: black; } - .postList { - display: flex; - flex-direction: column; - - flex: 1 1 auto; - - .postLink { - display: block; - text-decoration: none; - border-radius: 4px; - margin: 8px 0; - } - - .postLink:hover { - text-decoration: none; - background-color: #f5f5f5; - } - - .postListItem { - display: flex; - flex-direction: column; - justify-content: space-between; - - height: 114px; - margin: 0; - padding: 8px 4px; - - .postTitle { - color: black; - font-weight: 500; - font-size: 17px; - } - - .postDescription { - color: grey; - font-weight: 400; - font-size: 15px; - } - - .postDetails { - display: flex; - - color: black; - font-size: 16px; - font-weight: 300; - text-transform: uppercase; - - .postDetailsComments { - margin-right: 16px; - } - - .postDetailsStatus { - display: flex; - } - - } - } + .postLink:hover { + text-decoration: none; + background-color: #f5f5f5; } -} -.infoText { - display: block; - text-align: center; - font-style: italic; + .postListItem { + height: 114px; + } } \ No newline at end of file diff --git a/app/javascript/stylesheets/components/Roadmap.scss b/app/javascript/stylesheets/components/Roadmap.scss index 3aa222f7..667e8fde 100644 --- a/app/javascript/stylesheets/components/Roadmap.scss +++ b/app/javascript/stylesheets/components/Roadmap.scss @@ -1,10 +1,4 @@ .roadmapColumns { - display: flex; - flex: 1 1 auto; - justify-content: space-between; - align-items: flex-start; - flex-wrap: wrap; - @media (max-width: 800px) { .roadmapColumn { width: 100%; @@ -16,70 +10,13 @@ width: 32%; } } - - .roadmapColumn { - border-width: 1px; - border-style: solid; - border-radius: 4px; - - margin: 8px 0; - padding: 8px; - .columnHeader { - display: flex; - align-items: center; - - padding-bottom: 4px; - border-bottom-style: solid; - border-bottom-width: 1px; - margin-bottom: 8px; - } + .scrollContainer { + overflow-y: auto; + max-height: 350px; + } - .infoText { - text-align: center; - font-style: italic; - } - - .columnTitle { - font-weight: 700; - } - - .scrollContainer { - overflow-y: auto; - max-height: 350px; - - .postList { - display: flex; - flex-direction: column; - - .postLink { - text-decoration: none; - border-radius: 4px; - } - - .postLink:hover { - text-decoration: none; - background-color: #f5f5f5; - } - - .postListItem { - margin: 4px 0; - padding: 8px 4px; - } - - .postTitle { - color: black; - font-weight: 500; - font-size: 17px; - } - - .postBoard { - color: grey; - font-weight: 400; - font-size: 14px; - text-transform: uppercase; - } - } - } + .postLink:hover { + text-decoration: none; } } \ No newline at end of file diff --git a/spec/system/board_spec.rb b/spec/system/board_spec.rb index de4c357c..c4efe383 100644 --- a/spec/system/board_spec.rb +++ b/spec/system/board_spec.rb @@ -115,7 +115,7 @@ feature 'board', type: :system, js: true do fill_in 'Description (optional)', with: post_description click_button 'Submit feedback' # submit - expect(page).to have_selector('.success') + expect(page).to have_selector('.text-success') end visit board_path(board) @@ -161,7 +161,7 @@ feature 'board', type: :system, js: true do expect(page).to have_content(/#{post3.title}/i) within sidebar do - fill_in 'Search:', with: post1.title + find('#searchPostInput').set post1.title end expect(page).to have_content(/#{post1.title}/i) @@ -169,7 +169,7 @@ feature 'board', type: :system, js: true do expect(page).to have_no_content(/#{post3.title}/i) within sidebar do - fill_in 'Search:', with: post2.description + find('#searchPostInput').set post2.description end expect(page).to have_no_content(/#{post1.description}/i)