Skip to content

Commit 35558ba

Browse files
committed
add actions side bar
1 parent 399e6b7 commit 35558ba

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

src/components/Actions.tsx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import {
2+
Anchor,
3+
Paper,
4+
PaperProps,
5+
Stack,
6+
ThemeIcon,
7+
Tooltip
8+
} from '@mantine/core';
9+
import {
10+
IconCircleDot,
11+
IconGitPullRequest,
12+
IconHeart,
13+
IconStar
14+
} from '@tabler/icons-react';
15+
import React from 'react';
16+
17+
const IconStyle = { width: '70%', height: '70%' };
18+
19+
const Data = [
20+
{
21+
label: 'Issue!',
22+
href: 'https://github.com/Sorosliu1029/jupyterlab-leetcode/issues/new/choose',
23+
icon: <IconCircleDot style={IconStyle} />
24+
},
25+
{
26+
label: 'Star!',
27+
href: 'https://github.com/Sorosliu1029/jupyterlab-leetcode',
28+
icon: <IconStar style={IconStyle} />
29+
},
30+
{
31+
label: 'Contribute!',
32+
href: 'https://github.com/Sorosliu1029/jupyterlab-leetcode/blob/master/CONTRIBUTING.md',
33+
icon: <IconGitPullRequest style={IconStyle} />
34+
},
35+
{
36+
label: 'Sponsor!',
37+
href: 'https://github.com/Sorosliu1029',
38+
icon: <IconHeart style={IconStyle} />
39+
}
40+
];
41+
42+
const Actions: React.FC<{
43+
paperProps: PaperProps;
44+
}> = ({ paperProps }) => {
45+
return (
46+
<Paper {...paperProps}>
47+
<Stack gap="xs">
48+
{...Data.map(item => (
49+
<Tooltip label={item.label} key={item.label}>
50+
<Anchor
51+
size="xs"
52+
target="_blank"
53+
underline="never"
54+
href={item.href}
55+
>
56+
<ThemeIcon size="sm" variant="white">
57+
{item.icon}
58+
</ThemeIcon>
59+
</Anchor>
60+
</Tooltip>
61+
))}
62+
</Stack>
63+
</Paper>
64+
);
65+
};
66+
67+
export default Actions;

src/components/LeetCodeMain.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { LeetCodeProfile } from '../types/leetcode';
77
import Profile from './Profile';
88
import Statistics from './Statistics';
99
import QuestionTable from './QuestionTable';
10+
import Actions from './Actions';
1011

1112
const MainHeaderPaperProps: PaperProps = {
1213
shadow: 'md',
@@ -60,6 +61,7 @@ const LeetCodeMain: React.FC<{ docManager: IDocumentManager }> = ({
6061
paperProps={MainHeaderPaperProps}
6162
username={profile?.username}
6263
/>
64+
<Actions paperProps={MainHeaderPaperProps} />
6365
</Group>
6466
<QuestionTable openNotebook={openNoteBook} height={calcHeight()} />
6567
</Stack>

0 commit comments

Comments
 (0)