mirror of
https://github.com/jaronpate/unicord.git
synced 2026-10-18 21:47:40 +00:00
feat: Add reusable CodeExample component with hydration section
This commit is contained in:
@@ -206,6 +206,49 @@
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.hydrationSection {
|
||||
padding: 6rem 15em;
|
||||
min-height: 50vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
border-top: 1px solid var(--gray-alpha-200);
|
||||
}
|
||||
|
||||
.hydrationContainer {
|
||||
display: flex;
|
||||
gap: 4rem;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
.hydrationCode {
|
||||
flex: 1;
|
||||
min-width: 45%;
|
||||
}
|
||||
|
||||
.hydrationText {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.hydrationText h2 {
|
||||
color: #ff0080;
|
||||
margin: 0 0 1.5rem 0;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.hydrationText p {
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
margin: 1rem 0;
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.pillars {
|
||||
padding: 4rem 2rem;
|
||||
@@ -220,4 +263,22 @@
|
||||
max-width: 400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
.hydrationSection {
|
||||
padding: 4rem 2rem;
|
||||
}
|
||||
|
||||
.hydrationContainer {
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.hydrationCode {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.hydrationText {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,12 @@ import styles from "./page.module.css";
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
const CodeExample = dynamic(
|
||||
() => import('../components/CodeExample')
|
||||
() => import('../components/CodeExample'),
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
import { simpleExample, hydrationExample } from '../components/CodeExample';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div className={[styles.page, styles.pageWithHeader].join(" ")}>
|
||||
@@ -25,7 +28,7 @@ export default function Home() {
|
||||
</p>
|
||||
</div>
|
||||
<div className={styles.codeExample}>
|
||||
<CodeExample />
|
||||
<CodeExample code={simpleExample} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -48,6 +51,28 @@ export default function Home() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.hydrationSection}>
|
||||
<div className={styles.hydrationContainer}>
|
||||
<div className={styles.hydrationCode}>
|
||||
<CodeExample code={hydrationExample} height={400} />
|
||||
</div>
|
||||
<div className={styles.hydrationText}>
|
||||
<h2>Smart Hydration</h2>
|
||||
<p>
|
||||
Unicord's hydration system automatically manages Discord object lifecycles.
|
||||
The context.hydrate method intelligently fetches and caches Discord objects
|
||||
like messages, users, and guilds, ensuring your bot stays efficient while
|
||||
keeping your code clean and predictable.
|
||||
</p>
|
||||
<p>
|
||||
In this example, we're hydrating a message object to calculate ping times,
|
||||
demonstrating how Unicord handles complex Discord API interactions with
|
||||
simple, intuitive code.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user