Skip to content

Commit 283c4c7

Browse files
feat: ai agents front page
Signed-off-by: David Dal Busco <david.dalbusco@outlook.com>
1 parent c45ed39 commit 283c4c7

6 files changed

Lines changed: 153 additions & 0 deletions

File tree

src/components/Ai/index.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import BashSnippet from "@site/src/components/BashSnippet";
2+
import styles from "./styles.module.scss";
3+
4+
export default function Build(): JSX.Element {
5+
return (
6+
<div className={styles.section}>
7+
<h2 className={styles.sub}>
8+
Building with <span className={styles.agents}>AI agents</span>?
9+
</h2>
10+
<p className={styles.text}>
11+
Give them instant knowledge by installing skills.
12+
</p>
13+
14+
<BashSnippet
15+
cmd="npx skills add junobuild/skills"
16+
analyticsEventName="copy_ai_snippet"
17+
></BashSnippet>
18+
</div>
19+
);
20+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@use "../../mixins/fonts";
2+
3+
.section {
4+
display: flex;
5+
flex-direction: column;
6+
align-items: center;
7+
}
8+
9+
.sub {
10+
margin: 6rem 0 0.75rem;
11+
text-align: center;
12+
@include fonts.h2;
13+
}
14+
15+
.agents {
16+
html[data-theme="light"] & {
17+
text-decoration: underline;
18+
text-underline-offset: 2px;
19+
text-decoration-color: var(--ifm-color-primary);
20+
text-decoration-style: wavy;
21+
}
22+
}
23+
24+
.text {
25+
max-width: 324px;
26+
margin-bottom: 2rem;
27+
text-align: center;
28+
29+
@media screen and (min-width: 768px) {
30+
max-width: 524px;
31+
}
32+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
2+
import { trackEvent } from "@site/src/providers/analytics.providers";
3+
import CodeBlock from "@theme/CodeBlock";
4+
import { useRef } from "react";
5+
import styles from "./styles.module.scss";
6+
7+
export default function BashSnippet({
8+
analyticsEventName,
9+
cmd
10+
}: {
11+
analyticsEventName: string;
12+
cmd: string;
13+
}): JSX.Element {
14+
const { siteConfig } = useDocusaurusContext();
15+
const container = useRef(null);
16+
17+
const onClick = async ({ target }: MouseEvent) => {
18+
const btn = container.current?.querySelector('button[title="Copy"]');
19+
20+
if (!btn?.contains(target)) {
21+
return;
22+
}
23+
24+
await trackEvent({
25+
name: analyticsEventName,
26+
siteConfig
27+
});
28+
};
29+
30+
return (
31+
<div
32+
className={styles.code}
33+
ref={container}
34+
onClick={async ($event) => onClick($event as unknown as MouseEvent)}
35+
>
36+
<svg
37+
xmlns="http://www.w3.org/2000/svg"
38+
height="24"
39+
viewBox="0 -960 960 960"
40+
width="24"
41+
fill="#00fff5"
42+
className={styles.bash}
43+
>
44+
<path d="M530-481 353-658q-9-9-8.5-21t9.5-21q9-9 21.5-9t21.5 9l198 198q5 5 7 10t2 11q0 6-2 11t-7 10L396-261q-9 9-21 8.5t-21-9.5q-9-9-9-21.5t9-21.5l176-176Z" />
45+
</svg>
46+
<CodeBlock className="code-npm">{cmd}</CodeBlock>
47+
</div>
48+
);
49+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.code {
2+
position: relative;
3+
4+
:global(.code-npm) {
5+
width: 340px;
6+
box-shadow: none;
7+
margin: 0;
8+
9+
code {
10+
padding: var(--ifm-pre-padding) var(--ifm-pre-padding)
11+
var(--ifm-pre-padding) 2rem;
12+
}
13+
14+
span {
15+
color: #00fff5;
16+
}
17+
18+
button {
19+
opacity: 1;
20+
border-color: transparent;
21+
padding-top: 0.55rem;
22+
}
23+
24+
button[aria-label="Toggle word wrap"] {
25+
display: none;
26+
}
27+
}
28+
}
29+
30+
.bash {
31+
position: absolute;
32+
left: 0.75rem;
33+
top: 50%;
34+
transform: translate(0, -50%);
35+
36+
z-index: 1;
37+
}

src/pages/index.module.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
}
4040
}
4141

42+
.ai {
43+
@include section.section;
44+
45+
padding: 1rem 3rem 6rem;
46+
47+
@media screen and (min-width: 1140px) {
48+
padding: 1rem 3rem 6rem;
49+
}
50+
}
51+
4252
.block {
4353
@include section.section;
4454

src/pages/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
22
import { initOrbiter } from "@junobuild/analytics";
3+
import AI from "@site/src/components/Ai";
34
import Build from "@site/src/components/Build";
45
import Features from "@site/src/components/Features";
56
import Head from "@site/src/components/Head";
@@ -56,6 +57,10 @@ export default function Home(): JSX.Element {
5657
<Launch />
5758
</section>
5859

60+
<section className={`container ${styles.ai}`}>
61+
<AI />
62+
</section>
63+
5964
<section className={`container ${styles.block}`}>
6065
<Testimonials />
6166
</section>

0 commit comments

Comments
 (0)