Skip to content

Commit 36b58a5

Browse files
authored
Merge pull request #928 from jsonwebtoken/feature/skills-banner
Add a jwt-skills banner
2 parents e5b52cd + 3f4c5ee commit 36b58a5

9 files changed

Lines changed: 269 additions & 14 deletions

File tree

package-lock.json

Lines changed: 21 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/home/components/assets/assets.component.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { Button } from "react-aria-components";
1919
import { ArrowHeadIconComponent } from "@/features/common/assets/arrow-head-icon.component";
2020
import { Auth0DictionaryModel } from "@/features/localization/models/auth0-dictionary.model";
2121
import { Auth0CtaComponent } from "@/features/common/components/auth0-cta/auth0-cta.component";
22+
import { SkillsCtaComponent } from "./skills-cta.component";
2223

2324
type AssetsComponentProps = {
2425
languageCode: string;
@@ -63,6 +64,10 @@ export const AssetsComponent: React.FC<AssetsComponentProps> = ({
6364
languageCode={languageCode}
6465
dictionary={auth0Dictionary.banner}
6566
/>
67+
<SkillsCtaComponent
68+
languageCode={languageCode}
69+
dictionary={jwtDictionary.skills}
70+
/>
6671
</div>
6772
);
6873
};

src/features/home/components/assets/assets.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
width: calc(100% - 2rem);
2929
max-width: 1312px;
3030
margin: 0 auto;
31-
grid-row-gap: unset;
32-
row-gap: unset;
31+
row-gap: 1rem;
3332
}
3433

3534
}
@@ -52,6 +51,7 @@
5251
}
5352
}
5453

54+
5555
.assets__title {
5656
width: 100%;
5757
margin: 0;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React from "react";
2+
import { JwtDictionaryModel } from "@/features/localization/models/jwt-dictionary.model";
3+
import { CardWithHeadlineComponent } from "@/features/common/components/card/card.component";
4+
import { CardToolbarComponent } from "@/features/common/components/card-toolbar/card-toolbar.component";
5+
import { CardToolbarCopyButtonComponent } from "@/features/common/components/card-toolbar-buttons/card-toolbar-copy-button/card-toolbar-copy-button.component";
6+
7+
const COMMAND = "npx skills add jsonwebtoken/jwt-skills";
8+
const COMMAND_SPECIFIC = "npx skills add jsonwebtoken/jwt-skills -s jwt-decode";
9+
10+
const labelStyle: React.CSSProperties = {
11+
fontSize: "0.75rem",
12+
lineHeight: "1.25rem",
13+
opacity: 0.6,
14+
};
15+
16+
interface Props {
17+
languageCode: string;
18+
dictionary: JwtDictionaryModel["skills"];
19+
}
20+
21+
export const SkillsCardComponent: React.FC<Props> = ({ languageCode, dictionary }) => {
22+
return (
23+
<CardWithHeadlineComponent
24+
sectionHeadline={null}
25+
id="skills-card"
26+
languageCode={languageCode}
27+
title="Terminal"
28+
compactTitle="Terminal"
29+
hasHeaderIcon
30+
options={null}
31+
slots={{
32+
toolbar: (
33+
<CardToolbarComponent ariaLabel="Skills command toolbar">
34+
<CardToolbarCopyButtonComponent
35+
languageCode={languageCode}
36+
value={COMMAND}
37+
/>
38+
</CardToolbarComponent>
39+
),
40+
}}
41+
messages={null}
42+
>
43+
<p style={labelStyle}>{dictionary.installAllSkills}</p>
44+
<code>{"$ " + COMMAND}</code>
45+
<p style={{ ...labelStyle, marginTop: "0.75rem" }}>{dictionary.installSpecificSkill}</p>
46+
<code>{"$ " + COMMAND_SPECIFIC}</code>
47+
</CardWithHeadlineComponent>
48+
);
49+
};
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React from "react";
2+
import styles from "./skills-cta.module.scss";
3+
import { clsx } from "clsx";
4+
import Link from "next/link";
5+
import { JwtDictionaryModel } from "@/features/localization/models/jwt-dictionary.model";
6+
import { getLocalizedSecondaryFont } from "@/libs/theme/fonts";
7+
import { ArrowHeadIconComponent } from "@/features/common/assets/arrow-head-icon.component";
8+
import { SkillsCardComponent } from "./skills-card.component";
9+
10+
interface SkillsCtaComponentProps {
11+
languageCode: string;
12+
dictionary: JwtDictionaryModel["skills"];
13+
}
14+
15+
export const SkillsCtaComponent: React.FC<SkillsCtaComponentProps> = ({
16+
languageCode,
17+
dictionary,
18+
}) => {
19+
return (
20+
<div className={styles.container}>
21+
<div className={styles.left}>
22+
<h4
23+
className={clsx(
24+
styles.title,
25+
getLocalizedSecondaryFont(languageCode),
26+
)}
27+
>
28+
{dictionary.title}
29+
</h4>
30+
<div className={styles.content}>
31+
<p className={styles.description}>{dictionary.description}</p>
32+
<Link
33+
className={styles.link}
34+
href={dictionary.ctaButton.path}
35+
target="_blank"
36+
rel="noreferrer noopener"
37+
>
38+
{dictionary.ctaButton.label}
39+
<ArrowHeadIconComponent />
40+
</Link>
41+
</div>
42+
</div>
43+
<div className={styles.right}>
44+
<SkillsCardComponent languageCode={languageCode} dictionary={dictionary} />
45+
</div>
46+
</div>
47+
);
48+
};

0 commit comments

Comments
 (0)