-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Mathias Havekes <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Theo Auffeuvre <[email protected]>
- Loading branch information
1 parent
caa5f07
commit 0c23345
Showing
7 changed files
with
118 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { SiteSocial } from '../services/api' | ||
|
||
const CreatePostWidget = (props: { readonly site: SiteSocial }) => { | ||
/* eslint-disable @typescript-eslint/no-unused-vars -- We'll use this eventually */ | ||
// @ts-expect-error: We'll use this eventually | ||
const { site } = props | ||
/* eslint-enable @typescript-eslint/no-unused-vars -- We'll use this eventually */ | ||
|
||
return ( | ||
<div className='bg-white rounded-2 px-5 py-4 d-flex flex-column gap-2'> | ||
<div className='d-flex justify-content-between'> | ||
<h2>New Post</h2> | ||
<button className='btn btn-secondary' type='button'> | ||
Publish | ||
</button> | ||
</div> | ||
<div className='position-relative'> | ||
<div className='position-absolute top-0 left-0 m-3 d-flex gap-3 fs-3'> | ||
<span className='material-symbols-outlined'>mood</span> | ||
<span className='material-symbols-outlined'>add_a_photo</span> | ||
<span className='material-symbols-outlined'>smart_display</span> | ||
</div> | ||
<textarea className='form-control pt-5' id='exampleFormControlTextarea1' placeholder='Post a New Message...'> | ||
</textarea> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default CreatePostWidget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import canopeumLogo from '@assets/images/Canopeum_Logo.jpg' | ||
|
||
import type { Post } from '../services/api' | ||
import { formatDate } from '../utils/dateFormatter' | ||
|
||
const PostWidget = (props: { readonly post: Post }) => { | ||
const { post } = props | ||
|
||
return ( | ||
<div className='bg-white rounded-2 px-5 py-4 d-flex flex-column gap-3'> | ||
<div className='d-flex justify-content-start gap-2'> | ||
<img alt='site' className='rounded-circle' src={canopeumLogo} style={{ height: '48px', width: '48px' }} /> | ||
<div className='d-flex flex-column'> | ||
<div>{post.site.name}</div> | ||
{post.createdAt && <div>{formatDate(post.createdAt.toISOString())}</div>} | ||
</div> | ||
</div> | ||
|
||
<div>{post.body}</div> | ||
|
||
<div className='d-flex justify-content-end gap-4'> | ||
<div className='d-flex gap-2'> | ||
<span className='material-symbols-outlined'>eco</span> | ||
<div>{post.likeCount}</div> | ||
</div> | ||
<div className='d-flex gap-2'> | ||
<span className='material-symbols-outlined'>sms</span> | ||
<div>{post.commentCount}</div> | ||
</div> | ||
<div className='d-flex gap-2'> | ||
<span className='material-symbols-outlined'>share</span> | ||
<div>{post.shareCount}</div> | ||
</div> | ||
<div /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default PostWidget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export const formatDate = (dateIso: string): string => { | ||
const date = new Date(dateIso) | ||
|
||
const day = String(date.getDate()).padStart(2, '0') | ||
const month = String(date.getMonth() + 1).padStart(2, '0') | ||
const year = date.getFullYear() | ||
const hours = String(date.getHours()).padStart(2, '0') | ||
const minutes = String(date.getMinutes()).padStart(2, '0') | ||
|
||
return `${day}-${month}-${year} ${hours}:${minutes}` | ||
} |