Skip to content

Commit 9aff449

Browse files
committed
add footer component
1 parent 2d6be77 commit 9aff449

File tree

7 files changed

+73
-9
lines changed

7 files changed

+73
-9
lines changed

src/components/BrowserCookie.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const BrowserCookie: React.FC<{
146146
</Menu.Target>
147147
<Menu.Dropdown>
148148
<Menu.Label>With LeetCode logged in</Menu.Label>
149-
{BROWSERS.map(({ name, icon }, i) => (
149+
{BROWSERS.map(({ name, icon }) => (
150150
<Menu.Item
151151
key={name}
152152
leftSection={icon(theme.colors.blue[6])}

src/components/Footer.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from 'react';
2+
import { Anchor, Container, Group } from '@mantine/core';
3+
import classes from '../styles/Footer.module.css';
4+
import { IconBrandLeetcode } from '@tabler/icons-react';
5+
6+
const LINKS = [
7+
{
8+
link: 'https://github.com/Sorosliu1029/jupyterlab-leetcode',
9+
label: 'GitHub'
10+
},
11+
{ link: 'https://pypi.org/project/jupyterlab-leetcode/', label: 'PyPi' },
12+
{ link: 'https://www.npmjs.com/package/jupyterlab-leetcode', label: 'NPM' }
13+
];
14+
15+
const Footer = () => {
16+
return (
17+
<div className={classes.footer}>
18+
<Container className={classes.inner}>
19+
<IconBrandLeetcode size={28} />
20+
<Group className={classes.links}>
21+
{LINKS.map(link => (
22+
<Anchor<'a'>
23+
c="dimmed"
24+
key={link.label}
25+
href={link.link}
26+
target="_blank"
27+
size="sm"
28+
>
29+
{link.label}
30+
</Anchor>
31+
))}
32+
</Group>
33+
</Container>
34+
</div>
35+
);
36+
};
37+
38+
export default Footer;

src/components/LandingPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import BrowserCookie from './BrowserCookie';
44
import { Button, Container, Group, Text, Tooltip, Anchor } from '@mantine/core';
55
import { IconBrandGithub, IconBrandLinkedin } from '@tabler/icons-react';
66
import classes from '../styles/LandingPage.module.css';
7+
import Footer from './Footer';
78

89
const LeetCdoeGradient = { from: '#FEA512', to: '#FFDB01' };
910

@@ -57,7 +58,7 @@ const LandingPage: React.FC<{
5758
plugin
5859
</h1>
5960

60-
<Text className={classes.description} color="dimmed">
61+
<Text className={classes.description} c="dimmed">
6162
For this plugin to work, you may choose one of these {options.length}{' '}
6263
methods to allow this plugin to{' '}
6364
<Anchor
@@ -73,6 +74,8 @@ const LandingPage: React.FC<{
7374
</Text>
7475

7576
<Group className={classes.controls}>{...options}</Group>
77+
78+
<Footer />
7679
</Container>
7780
</div>
7881
);

src/components/LeetCodeNotebookToolbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ICellModel } from '@jupyterlab/cells';
66
import { PromiseDelegate, ReadonlyJSONValue } from '@lumino/coreutils';
77
import { submitNotebook } from '../services/notebook';
88
import { makeWebSocket } from '../services/handler';
9-
import { leetcodeIcon } from '../icons/leetcode';
9+
import { LeetCodeIcon } from '../icons/leetcode';
1010
import {
1111
LeetCodeSubmissionResult,
1212
LeetCodeWebSocketMessage
@@ -208,7 +208,7 @@ const LeetCodeNotebookToolbar: React.FC<{ notebook: NotebookPanel }> = ({
208208
<ToolbarButtonComponent
209209
onClick={submit}
210210
tooltip="Submit to LeetCode"
211-
icon={leetcodeIcon}
211+
icon={LeetCodeIcon}
212212
/>
213213
);
214214
};

src/icons/leetcode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { LabIcon } from '@jupyterlab/ui-components';
22

3-
export const leetcodeIcon = new LabIcon({
3+
export const LeetCodeIcon = new LabIcon({
44
name: 'leetcode:submit',
55
svgstr:
66
'<svg width="95" height="111" viewBox="0 0 95 111" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M68.0063 83.0664C70.5 80.5764 74.5366 80.5829 77.0223 83.0809C79.508 85.579 79.5015 89.6226 77.0078 92.1127L65.9346 103.17C55.7187 113.371 39.06 113.519 28.6718 103.513C28.6117 103.456 23.9861 98.9201 8.72653 83.957C-1.42528 74.0029 -2.43665 58.0749 7.11648 47.8464L24.9282 28.7745C34.4095 18.6219 51.887 17.5122 62.7275 26.2789L78.9048 39.362C81.6444 41.5776 82.0723 45.5985 79.8606 48.3429C77.6488 51.0873 73.635 51.5159 70.8954 49.3003L54.7182 36.2173C49.0488 31.6325 39.1314 32.2622 34.2394 37.5006L16.4274 56.5727C11.7767 61.5522 12.2861 69.574 17.6456 74.8292C28.851 85.8169 37.4869 94.2846 37.4969 94.2942C42.8977 99.496 51.6304 99.4184 56.9331 94.1234L68.0063 83.0664Z" fill="#FFA116"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M41.1067 72.0014C37.5858 72.0014 34.7314 69.1421 34.7314 65.615C34.7314 62.0879 37.5858 59.2286 41.1067 59.2286H88.1245C91.6454 59.2286 94.4997 62.0879 94.4997 65.615C94.4997 69.1421 91.6454 72.0014 88.1245 72.0014H41.1067Z" fill="#B3B3B3"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M49.9118 2.02335C52.3173 -0.55232 56.3517 -0.686894 58.9228 1.72277C61.494 4.13244 61.6284 8.17385 59.2229 10.7495L16.4276 56.5729C11.7768 61.552 12.2861 69.5738 17.6453 74.8292L37.4088 94.2091C39.9249 96.6764 39.968 100.72 37.505 103.24C35.042 105.761 31.0056 105.804 28.4895 103.337L8.72593 83.9567C-1.42529 74.0021 -2.43665 58.0741 7.1169 47.8463L49.9118 2.02335Z" fill="black"></path></svg>'

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
import { NotebookPanel } from '@jupyterlab/notebook';
1616
import { ILauncher } from '@jupyterlab/launcher';
1717
import '@mantine/core/styles.css';
18-
import { leetcodeIcon } from './icons/leetcode';
18+
import { LeetCodeIcon } from './icons/leetcode';
1919

2020
import { LeetCodeMainWidget, LeetCodeToolbarWidget } from './widget';
2121

@@ -44,14 +44,14 @@ const plugin: JupyterFrontEndPlugin<void> = {
4444
app.commands.addCommand(command, {
4545
caption: 'LeetCode',
4646
label: 'LeetCode',
47-
icon: args => (args['isPalette'] ? undefined : leetcodeIcon),
47+
icon: args => (args['isPalette'] ? undefined : LeetCodeIcon),
4848
execute: () => {
4949
if (!leetcodeWidget || leetcodeWidget.isDisposed) {
5050
leetcodeWidget = new MainAreaWidget<LeetCodeMainWidget>({
5151
content: new LeetCodeMainWidget(app, docManager)
5252
});
5353
leetcodeWidget.title.label = 'LeetCode Widget';
54-
leetcodeWidget.title.icon = leetcodeIcon;
54+
leetcodeWidget.title.icon = LeetCodeIcon;
5555
}
5656
if (!tracker.has(leetcodeWidget)) {
5757
tracker.add(leetcodeWidget);
@@ -77,7 +77,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
7777
restorer.restore(tracker, { command, name: () => 'leetcode' });
7878
}
7979
// auto attach to LeetCode notebook
80-
docWidgetOpener.opened.connect((sender, widget) => {
80+
docWidgetOpener.opened.connect((__sender, widget) => {
8181
if (widget instanceof NotebookPanel) {
8282
widget.revealed.then(() => {
8383
if (widget.model?.metadata?.leetcode_question_info) {

src/styles/Footer.module.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.footer {
2+
margin-top: 120px;
3+
border-top: 1px solid
4+
light-dark(var(--mantine-color-gray-2), var(--mantine-color-dark-5));
5+
}
6+
7+
.inner {
8+
display: flex;
9+
justify-content: space-between;
10+
align-items: center;
11+
padding-top: var(--mantine-spacing-md);
12+
padding-bottom: var(--mantine-spacing-md);
13+
14+
@media (max-width: $mantine-breakpoint-xs) {
15+
flex-direction: column;
16+
}
17+
}
18+
19+
.links {
20+
@media (max-width: $mantine-breakpoint-xs) {
21+
margin-top: var(--mantine-spacing-md);
22+
}
23+
}

0 commit comments

Comments
 (0)