-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: 編集メニューを表示しない
ArticleSummaryPaper
を実装して記事一覧で表示する
- Loading branch information
Showing
3 changed files
with
46 additions
and
7 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
42 changes: 42 additions & 0 deletions
42
apps/web/src/components/models/article/ArticleSummaryPaper/ArticleSummaryPaper.tsx
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,42 @@ | ||
'use client'; | ||
|
||
import { Box, Link, Paper, Typography } from '@mui/material'; | ||
import type { Blog, PublishArticle } from '@repo/types'; | ||
import { format } from 'date-fns'; | ||
import type { FC } from 'react'; | ||
import urlJoin from 'url-join'; | ||
import { appUrls } from '~/constants/appUrls'; | ||
import { generateMainUrl } from '~/utils/generateMainUrl'; | ||
|
||
type Props = { | ||
blog: Blog; | ||
article: PublishArticle; | ||
}; | ||
|
||
export const ArticleSummaryPaper: FC<Props> = ({ blog, article }) => { | ||
return ( | ||
<Paper key={article.id} variant='outlined' sx={{ p: 2, display: 'flex', flexDirection: 'column', rowGap: 0.5 }}> | ||
<Box display='flex' alignItems='center' justifyContent='space-between'> | ||
<Link | ||
href={urlJoin(generateMainUrl(), appUrls.dashboard.blogs.articles.edit(blog.id, article.id))} | ||
underline='hover' | ||
color='inherit' | ||
> | ||
<Typography variant='h5' component='div'> | ||
{article.title === '' ? '無題' : article.title} | ||
</Typography> | ||
</Link> | ||
</Box> | ||
<Box sx={{ display: 'flex', flexDirection: 'column', rowGap: 3 }}> | ||
<Box display='flex' columnGap={2}> | ||
<Typography variant='caption' component='h6'> | ||
作成日:{format(article.createdAt, 'yyyy-MM-dd HH:mm')} | ||
</Typography> | ||
<Typography variant='caption' component='h6'> | ||
更新日:{format(article.updatedAt, 'yyyy-MM-dd HH:mm')} | ||
</Typography> | ||
</Box> | ||
</Box> | ||
</Paper> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
apps/web/src/components/models/article/ArticleSummaryPaper/index.ts
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 @@ | ||
export { ArticleSummaryPaper } from './ArticleSummaryPaper'; |