tcmd: styled links

This commit is contained in:
Emmaline Autumn 2024-02-29 02:37:50 -07:00
parent 18f8541de7
commit 7f63d38424
4 changed files with 26 additions and 7 deletions

View File

@ -4,13 +4,13 @@
@layer base { @layer base {
* { * {
@apply text-white @apply text-white box-border
} }
body { body {
@apply dark:bg-mixed-100 bg-primary-600 @apply dark:bg-mixed-100 bg-primary-600
} }
input { input {
@apply py-2 px-4 rounded-full dark:bg-mixed-200 dark:bg-mixed-600 placeholder:text-dark-500 @apply py-2 px-4 rounded-full dark:bg-mixed-200 bg-mixed-600 placeholder:text-dark-500
} }
h1,h2,h3,h4,h5,h6 { h1,h2,h3,h4,h5,h6 {
@apply font-bold @apply font-bold
@ -32,10 +32,10 @@
} }
.btn-primary { .btn-primary {
@apply bg-primary-500 py-4 px-6 text-mixed-100 rounded-full font-bold text-lg @apply dark:bg-primary-500 bg-primary-100 py-4 px-6 dark:text-mixed-100 text-white rounded-full font-bold text-lg
} }
.btn-secondary { .btn-secondary {
@apply text-primary-500 py-4 px-6 font-bold text-lg @apply dark:text-primary-500 text-primary-100 py-4 px-6 font-bold text-lg
} }
.p { .p {
@apply py-1 @apply py-1

View File

@ -186,7 +186,8 @@ const renderInlineToken = (l: Line) => {
case "anchor": case "anchor":
return ( return (
<Link <Link
className="dark:text-primary-600 underline dark:no-underline" className={token.data.style?.classes ||
"dark:text-primary-600 underline dark:no-underline"}
href={token.data.href} href={token.data.href}
> >
{token.content} {token.content}
@ -217,7 +218,7 @@ const renderInlineToken = (l: Line) => {
preferredEdge="bottom" preferredEdge="bottom"
className="cursor-pointer" className="cursor-pointer"
> >
<span className="border-b border-dotted border-white"> <span className="border-b-2 border-dotted border-white">
{token.content} {token.content}
</span> </span>
</Poppable> </Poppable>

View File

@ -94,12 +94,27 @@ export const inlineTokens: {
{ {
rx: /(?<![\!\?|^])\[(.*?)\]\((.*?)\)/g, rx: /(?<![\!\?|^])\[(.*?)\]\((.*?)\)/g,
create(content, start, end, tokens) { create(content, start, end, tokens) {
const [_, label, href] = content; let [_, label, href] = content;
const style = [
{
classes: "btn-primary inline-block",
rx: /^```button\s/,
},
{
classes: "btn-secondary inline-block uppercase",
rx: /^```cta\s/,
},
].find((s) => s.rx.test(label));
if (style) label = label.replace(style.rx, "");
tokens.push({ tokens.push({
content: label, content: label,
type: "anchor", type: "anchor",
data: { data: {
href, href,
style,
}, },
start, start,
end, end,

View File

@ -35,6 +35,9 @@ placerat. Auctor urna nunc id cursus metus aliquam eleifend.
ornare lectus sit amet est placerat. Auctor urna nunc id cursus metus ornare lectus sit amet est placerat. Auctor urna nunc id cursus metus
aliquam eleifend. aliquam eleifend.
[```button Learn More](#)
[```cta Learn More](#)
]] ]]
[[ [[