Adding heading colors
This commit is contained in:
parent
6031795a4b
commit
59e504957b
@ -23,4 +23,16 @@
|
|||||||
&.heading--font-size-extra_large > * {
|
&.heading--font-size-extra_large > * {
|
||||||
font-size: 64px;
|
font-size: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.heading--color-normal {
|
||||||
|
color: var(--color-brand-text-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.heading--color-accent1 {
|
||||||
|
color: var(--color-brand-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.heading--color-accent2 {
|
||||||
|
color: var(--color-brand-accent2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import type { ComponentToHTMLArgs } from "@sealcode/jdd";
|
|||||||
import { Component, ComponentArguments, insert_nbsp } from "@sealcode/jdd";
|
import { Component, ComponentArguments, insert_nbsp } from "@sealcode/jdd";
|
||||||
|
|
||||||
const component_arguments = {
|
const component_arguments = {
|
||||||
title: new ComponentArguments.ShortText(),
|
|
||||||
level: new ComponentArguments.Enum(["h1", "h2", "h3", "h4", "h5", "h6"]),
|
level: new ComponentArguments.Enum(["h1", "h2", "h3", "h4", "h5", "h6"]),
|
||||||
font_size: new ComponentArguments.Enum([
|
font_size: new ComponentArguments.Enum([
|
||||||
"tiny",
|
"tiny",
|
||||||
@ -12,6 +11,8 @@ const component_arguments = {
|
|||||||
"large",
|
"large",
|
||||||
"extra_large",
|
"extra_large",
|
||||||
]),
|
]),
|
||||||
|
color: new ComponentArguments.Enum(["normal", "accent1", "accent2"]),
|
||||||
|
title: new ComponentArguments.ShortText(),
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export class Heading extends Component<typeof component_arguments> {
|
export class Heading extends Component<typeof component_arguments> {
|
||||||
@ -20,11 +21,18 @@ export class Heading extends Component<typeof component_arguments> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async toHTML({
|
async toHTML({
|
||||||
args: { title, level, font_size },
|
args: { title, level, font_size, color },
|
||||||
classes,
|
classes,
|
||||||
}: ComponentToHTMLArgs<typeof component_arguments>): Promise<string> {
|
}: ComponentToHTMLArgs<typeof component_arguments>): Promise<string> {
|
||||||
return (
|
return (
|
||||||
<div class={["heading", `heading--font-size-${font_size}`, ...classes]}>
|
<div
|
||||||
|
class={[
|
||||||
|
"heading",
|
||||||
|
`heading--font-size-${font_size}`,
|
||||||
|
`heading--color-${color}`,
|
||||||
|
...classes,
|
||||||
|
]}
|
||||||
|
>
|
||||||
{`<${level}>${insert_nbsp(title)}</${level}>`}
|
{`<${level}>${insert_nbsp(title)}</${level}>`}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user