Skip to content

Commit b30a3d8

Browse files
committed
[refine] member, project, issue, github card
1 parent 9c63120 commit b30a3d8

File tree

14 files changed

+112
-78
lines changed

14 files changed

+112
-78
lines changed

components/Git/Issue/Card.tsx

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Avatar, Card, CardContent, CardProps, Chip } from '@mui/material';
1+
import { Avatar, Box, Card, CardContent, CardProps, Chip } from '@mui/material';
22
import { marked } from 'marked';
33
import { Issue } from 'mobx-github';
44
import { FC } from 'react';
@@ -9,6 +9,7 @@ export type IssueCardProps = Issue & Omit<CardProps, 'id'>;
99

1010
export const IssueCard: FC<IssueCardProps> = ({
1111
id,
12+
className = '',
1213
repository_url,
1314
number,
1415
title,
@@ -18,51 +19,60 @@ export const IssueCard: FC<IssueCardProps> = ({
1819
user,
1920
comments,
2021
created_at,
22+
component = 'li',
2123
...props
2224
}) => (
23-
<Card {...props}>
24-
<CardContent className="flex h-full flex-col justify-between gap-2">
25-
<h2 className="text-2xl font-semibold">
26-
<a
27-
href={html_url}
28-
target="_blank"
29-
rel="noreferrer"
30-
style={{ textDecoration: 'none', color: 'inherit' }}
31-
>
32-
{repository_url.split('/').slice(-2).join('/')}#{number}
33-
<br />
34-
{title}
35-
</a>
25+
<Box
26+
{...props}
27+
component={component}
28+
className={`elevation-1 hover:elevation-4 relative mb-4 grid break-inside-avoid grid-cols-1 grid-rows-5 gap-2 rounded-2xl border border-gray-200 p-4 dark:border-0 ${className}`}
29+
>
30+
<a
31+
className="row-span-1 text-2xl font-semibold"
32+
href={html_url}
33+
target="_blank"
34+
rel="noreferrer"
35+
>
36+
<h2 className="text-lg">
37+
{title}#{number}
3638
</h2>
39+
</a>
3740

38-
<div className="flex items-center gap-2">
39-
{labels?.map(
40-
label =>
41-
typeof label === 'object' && (
42-
<Chip
43-
key={label.name}
44-
label={label.name}
45-
style={{ backgroundColor: `#${label.color || 'e0e0e0'}` }}
46-
/>
47-
),
48-
)}
49-
</div>
41+
<ul className="scrollbar-none scroll-snap-x row-span-1 flex snap-mandatory flex-nowrap gap-2 overflow-x-scroll">
42+
{labels?.map(
43+
label =>
44+
typeof label === 'object' && (
45+
<Chip
46+
key={label.name}
47+
size="small"
48+
component="li"
49+
variant="outlined"
50+
color="primary"
51+
label={label.name}
52+
/>
53+
),
54+
)}
55+
</ul>
5056

51-
<article dangerouslySetInnerHTML={{ __html: marked(body || '', { async: false }) }} />
57+
<article
58+
dangerouslySetInnerHTML={{ __html: marked(body || '', { async: false }) }}
59+
className="row-span-3"
60+
/>
5261

53-
<footer className="flex items-center justify-between">
54-
{user && (
55-
<div className="flex items-center gap-2">
56-
<Avatar src={user.avatar_url} alt={user.name || ''} />
57-
{user.name || ''}
58-
</div>
59-
)}
62+
<footer className="row-span-1 flex items-center justify-between text-neutral-500">
63+
{user && (
6064
<div className="flex items-center gap-2">
61-
<SymbolIcon name="chat" />
62-
{comments}
65+
<Avatar src={user.avatar_url} alt={user.name || ''} />
66+
{user.name || ''}
6367
</div>
64-
<time dateTime={created_at}>{new Date(created_at).toLocaleString()}</time>
65-
</footer>
66-
</CardContent>
67-
</Card>
68+
)}
69+
<div className="flex items-center gap-2">
70+
<SymbolIcon name="chat" />
71+
{comments}
72+
</div>
73+
<time className="text-sm" dateTime={created_at}>
74+
{new Date(created_at).toLocaleString()}
75+
</time>
76+
</footer>
77+
</Box>
6878
);

components/Layout/MainNavigator.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ export class MainNavigator extends ObservedComponent<{}, typeof i18n> {
121121
<div className="flex flex-row items-center gap-3">
122122
{this.renderDrawer()}
123123

124-
<BrandLogo />
124+
<BrandLogo className="dark:!hidden" variant="black" />
125+
<BrandLogo className="!hidden dark:!block" variant="white" />
125126
<Link translate="no" className="font-bold uppercase" href="/" rel="home">
126127
idea2app
127128
</Link>

components/Layout/Svg.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export const OcticonIcon: FC<SvgIconProps> = props => (
1919

2020
export const GitpodIcon: FC<SvgIconProps> = props => (
2121
<SvgIcon {...props}>
22-
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 189 208">
22+
<svg width="96" height="96" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">
2323
<path
24-
d="M112.287 10.358c5.613 9.855 2.2 22.409-7.623 28.04L43.586 73.41a5.2 5.2 0 0 0-2.614 4.51V132.9c0 1.864.997 3.584 2.614 4.511l48.326 27.703a5.202 5.202 0 0 0 5.176 0l48.326-27.703a5.199 5.199 0 0 0 2.614-4.511v-34.19l-43.461 24.6c-9.854 5.577-22.35 2.085-27.909-7.8-5.56-9.885-2.079-22.42 7.775-27.997l62.187-35.2C165.563 41.592 189 55.322 189 77.14v59.926c0 14.036-7.497 26.996-19.645 33.96l-55.511 31.821a38.883 38.883 0 0 1-38.688 0l-55.51-31.821C7.496 164.062 0 151.102 0 137.066V73.754c0-14.036 7.497-26.996 19.645-33.96L84.336 2.712c9.823-5.63 22.337-2.207 27.951 7.647Z"
25-
clip-rule="evenodd"
24+
d="M91.8707 28.1143C93.7734 30.0343 94.9965 32.64 94.9965 35.6571V60.48C94.9965 63.4971 93.7734 66.1029 91.8707 68.0229L67.2722 92.8457C65.3695 94.9029 62.6515 96 59.7975 96H35.199C32.2091 96 29.6269 94.9029 27.5884 92.8457L2.98982 68.0229C1.08717 66.1029 -6.10352e-05 63.4971 -6.10352e-05 60.48V35.6571C-6.10352e-05 32.64 1.08717 30.0343 2.98982 27.9771L27.5884 3.15429C29.6269 1.23429 32.2091 0 35.199 0H59.7975C62.6515 0 65.3695 1.23429 67.2722 3.29143L91.8707 28.1143ZM72.4647 62.5656V33.5716C72.4647 27.6744 67.7081 22.7373 61.8642 22.7373H33.1322C27.1525 22.7373 22.3958 27.6744 22.3958 33.5716V62.5656C22.3958 68.4627 27.1525 73.2627 33.1322 73.2627H61.8642C67.7081 73.2627 72.4647 68.4627 72.4647 62.5656Z"
25+
fill="currentColor"
2626
/>
2727
</svg>
2828
</SvgIcon>

components/Member/Card.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export const MemberCard: FC<MemberCardProps> = observer(
4848
{(skill as string[]).map(value => (
4949
<Chip
5050
key={value}
51-
className=""
5251
size="small"
5352
component="li"
5453
variant="outlined"

components/Project/Card.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,32 @@ export const ProjectCard: FC<ProjectCardProps> = ({
2121
}) => (
2222
<Box
2323
component={component}
24-
className={`${className} flex flex-col justify-between gap-4 rounded-2xl border p-4 elevation-1 hover:elevation-8 dark:border-0`}
24+
className={`elevation-1 hover:elevation-4 relative rounded-2xl border border-gray-200 p-4 dark:border-0 ${className} mb-4 grid break-inside-avoid grid-cols-1 grid-rows-4 gap-2`}
2525
>
26-
<h2 className="flex items-center justify-between">
27-
<a className="text-lg" title={String(name)} href={`/project/${id}`}>
28-
{String(name)}
29-
</a>
26+
<a className="row-span-2 flex items-center justify-between" href={`/project/${id}`}>
27+
<h2 className="text-lg">{String(name)}</h2>
3028
<Chip label={String(workForm)} />
31-
</h2>
32-
<ul className="flex flex-row flex-wrap gap-3">
29+
</a>
30+
<ul className="scrollbar-none scroll-snap-x row-span-1 flex snap-mandatory flex-nowrap gap-2 overflow-x-scroll">
3331
{(type as string[])?.map(value => (
34-
<Chip key={value} component="li" size="small" label={value} />
32+
<Chip
33+
key={value}
34+
size="small"
35+
component="li"
36+
variant="outlined"
37+
color="primary"
38+
label={value}
39+
/>
3540
))}
3641
</ul>
37-
<div className="flex items-center justify-between">
42+
<div className="row-span-1 flex items-center justify-between">
3843
<strong className="flex-fill">
3944
{String(price).replace(/\d/g, (matched, offset) => (offset ? '0' : matched))}+
4045
</strong>
4146

42-
<time>🏁 {formatDate(+settlementDate!, 'YYYY-MM-DD')}</time>
47+
<time className="text-sm text-neutral-500">
48+
🏁 {formatDate(+settlementDate!, 'YYYY-MM-DD')}
49+
</time>
4350
</div>
4451
</Box>
4552
);

components/Project/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface ProjectListLayoutProps {
99
}
1010

1111
export const ProjectListLayout: FC<ProjectListLayoutProps> = ({ className = '', defaultData }) => (
12-
<ul className={`${className} grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3`}>
12+
<ul className={`${className} grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3`}>
1313
{defaultData.map(item => (
1414
<ProjectCard key={String(item.id)} className="h-full" {...item} />
1515
))}

pages/member/[nickname].tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ export default class MemberDetailPage extends ObservedComponent<
6363
<PageHead title={member.nickname as string} />
6464

6565
<div className="flex flex-col gap-4 md:flex-row">
66-
<ul className="w-full md:w-1/3">
66+
<ul className="w-full md:w-1/4">
6767
<MemberCard {...member} />
6868
</ul>
6969

70-
<div className="flex w-full flex-col items-center rounded-2xl border-2 md:w-2/3">
70+
<div className="flex w-full flex-col rounded-2xl md:w-3/4">
7171
<TabContext value={this.eventKey}>
7272
<TabList
73+
className="mx-auto"
7374
component="ul"
7475
aria-label="project tab"
7576
variant="fullWidth"
@@ -94,7 +95,7 @@ export default class MemberDetailPage extends ObservedComponent<
9495
))}
9596
</TabList>
9697
{entries.map(([label, list], index) => (
97-
<TabPanel key={label} value={index + ''}>
98+
<TabPanel key={label} className="px-0!" value={index + ''}>
9899
<ProjectListLayout defaultData={list} />
99100
</TabPanel>
100101
))}

pages/project/[id].tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ const ProjectDetailPage: FC<ProjectDetailPageProps> = observer(({ project, repos
4545
<PageHead title={String(project.name)} />
4646

4747
<div className="flex flex-col gap-4 md:flex-row">
48-
<a className="w-full md:w-2/3" href={String(project.link) || '#'}>
48+
<a
49+
className="w-full md:w-2/3"
50+
href={String(project.link) || '#'}
51+
target="_blank"
52+
rel="noreferrer"
53+
>
4954
{/**
5055
* @todo replace with LarkImage after R2 is ready
5156
*/}
@@ -57,9 +62,9 @@ const ProjectDetailPage: FC<ProjectDetailPageProps> = observer(({ project, repos
5762
<hr />
5863
<h2 className="text-xl">{t('open_source_project')}</h2>
5964

60-
<ul>
65+
<ul className="flex max-h-[45rem] snap-y flex-col gap-4 overflow-y-auto">
6166
{repositories.map(repository => (
62-
<GitCard key={repository.id} {...repository} />
67+
<GitCard key={repository.id} className="snap-center" {...repository} />
6368
))}
6469
</ul>
6570
</div>

pages/project/reward/issue.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,28 @@ export const getServerSideProps = compose(githubOAuth, errorLogger, async () =>
2525

2626
const IssuesPage: FC<{ list: Issue[] }> = observer(({ list }) => {
2727
const i18n = useContext(I18nContext);
28+
const { t } = i18n;
2829

2930
return (
30-
<Grid container className="px-4 py-20">
31-
<PageHead title="GitHub-reward issues" />
31+
<div className="container mx-auto max-w-screen-xl px-4 pt-16 pb-6">
32+
<PageHead title={t('github_reward_issues')} />
3233

33-
<h1>GitHub-reward issues</h1>
34+
<h1 className="my-8 text-4xl font-semibold">{t('github_reward_issues')}</h1>
3435

3536
<ScrollList
3637
translator={i18n}
3738
store={issueStore}
3839
filter={issueFilter}
3940
defaultData={list}
4041
renderList={allItems => (
41-
<Grid container spacing={2}>
42+
<ul className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
4243
{allItems.map(issue => (
43-
<Grid key={issue.id} size={{ xs: 12, sm: 6, md: 4 }}>
44-
<IssueCard className="h-full" {...issue} />
45-
</Grid>
44+
<IssueCard key={issue.id} className="h-full" {...issue} />
4645
))}
47-
</Grid>
46+
</ul>
4847
)}
4948
/>
50-
</Grid>
49+
</div>
5150
);
5251
});
5352

pages/wiki/[node_token].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ interface WikiDocumentPageProps {
4646
}
4747

4848
const WikiDocumentPage: FC<WikiDocumentPageProps> = ({ node, blocks }) => (
49-
<div className="prose container mx-auto max-w-screen-xl px-4 pt-16 pb-6">
49+
<div className="prose container mx-auto max-w-screen-xl px-4 pt-24 pb-6">
5050
<PageHead title={node.title} />
5151

5252
{renderBlocks(blocks)}

0 commit comments

Comments
 (0)