mirror of
https://github.com/jaronpate/unicord.git
synced 2026-10-18 21:47:40 +00:00
feat: Add type coercion section with code example and styling
This commit is contained in:
@@ -281,6 +281,67 @@
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.typeSection {
|
||||
padding: 4rem 2rem;
|
||||
}
|
||||
|
||||
.typeContainer {
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.typeCode {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.typeText {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.typeSection {
|
||||
padding: 6rem 12em;
|
||||
min-height: 50vh;
|
||||
display: flex;
|
||||
align-items: space;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
background: var(--gray-alpha-100);
|
||||
border-top: 1px solid var(--gray-alpha-200);
|
||||
}
|
||||
|
||||
.typeContainer {
|
||||
display: flex;
|
||||
gap: 4rem;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.typeText {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.typeCode {
|
||||
flex: 2;
|
||||
width: 100%;
|
||||
max-width: 780px;
|
||||
}
|
||||
|
||||
.typeText h2 {
|
||||
color: #ff0080;
|
||||
margin: 0 0 1.5rem 0;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.typeText p {
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
margin: 1rem 0;
|
||||
font-size: 1.1rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.hydrationText p code {
|
||||
@@ -291,4 +352,4 @@
|
||||
padding: 0.1em 0.2em;
|
||||
color: var(--foreground);
|
||||
border: 1px solid var(--gray-alpha-200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,28 @@ export default function Home() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.typeSection}>
|
||||
<div className={styles.typeContainer}>
|
||||
<div className={styles.typeText}>
|
||||
<h2>Type Coercion</h2>
|
||||
<p>
|
||||
Unicord automatically handles type coercion for command arguments,
|
||||
ensuring you always get the correct types in your handlers. Define your
|
||||
command structure once, and get full type safety and autocompletion
|
||||
throughout your codebase.
|
||||
</p>
|
||||
<p>
|
||||
In this example, the <code>user</code> argument is automatically typed
|
||||
as a <code>User</code> object, providing access to all user properties
|
||||
with full TypeScript support.
|
||||
</p>
|
||||
</div>
|
||||
<div className={styles.typeCode}>
|
||||
<CodeExample code={typeCoercionExample} height={300} noScroll={true} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user