Compare commits
3 commits
9d720d31b4
...
d2df08f140
Author | SHA1 | Date | |
---|---|---|---|
|
d2df08f140 | ||
|
bda41f0923 | ||
|
456cfdfbb0 |
8 changed files with 64 additions and 37 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { Component, JSX, splitProps } from "solid-js";
|
import { Component, JSX, splitProps } from "solid-js";
|
||||||
import materialStyles from "./material.module.css";
|
import materialStyles from "./material.module.css";
|
||||||
|
import "./typography.css";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Material-styled button.
|
* Material-styled button.
|
||||||
|
@ -10,12 +11,15 @@ const Button: Component<JSX.ButtonHTMLAttributes<HTMLButtonElement>> = (
|
||||||
props,
|
props,
|
||||||
) => {
|
) => {
|
||||||
const [managed, passthough] = splitProps(props, ["class", "type"]);
|
const [managed, passthough] = splitProps(props, ["class", "type"]);
|
||||||
const classes = () =>
|
|
||||||
managed.class
|
|
||||||
? [materialStyles.button, managed.class].join(" ")
|
|
||||||
: materialStyles.button;
|
|
||||||
const type = () => managed.type ?? "button";
|
const type = () => managed.type ?? "button";
|
||||||
return <button type={type()} class={classes()} {...passthough}></button>;
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type={type()}
|
||||||
|
class={`${materialStyles.button} buttonText ${managed.class || ""}`}
|
||||||
|
{...passthough}
|
||||||
|
></button>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Button;
|
export default Button;
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
composes: buttonText from "./typography.module.css";
|
|
||||||
composes: touchTarget;
|
composes: touchTarget;
|
||||||
|
|
||||||
border: none;
|
border: none;
|
||||||
|
|
|
@ -29,12 +29,11 @@
|
||||||
font-size: var(--subheading-size);
|
font-size: var(--subheading-size);
|
||||||
}
|
}
|
||||||
|
|
||||||
.body1 {
|
.body1, .body2 {
|
||||||
font-size: var(--body-size);
|
font-size: var(--body-size);
|
||||||
}
|
}
|
||||||
|
|
||||||
.body2 {
|
.body2 {
|
||||||
composes: body1;
|
|
||||||
font-weight: var(--body2-weight);
|
font-weight: var(--body2-weight);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { JSX, ParentComponent, splitProps, type Ref } from "solid-js";
|
import { JSX, ParentComponent, splitProps, type Ref } from "solid-js";
|
||||||
import { Dynamic } from "solid-js/web";
|
import { Dynamic } from "solid-js/web";
|
||||||
import typography from "./typography.module.css";
|
import "./typography.css";
|
||||||
import { mergeClass } from "../utils";
|
|
||||||
|
|
||||||
type AnyElement = keyof JSX.IntrinsicElements | ParentComponent<any>;
|
type AnyElement = keyof JSX.IntrinsicElements | ParentComponent<any>;
|
||||||
|
|
||||||
|
@ -40,13 +39,11 @@ export function Typography<T extends AnyElement>(
|
||||||
"class",
|
"class",
|
||||||
"typography",
|
"typography",
|
||||||
]);
|
]);
|
||||||
const classes = () =>
|
|
||||||
mergeClass(managed.class, typography[managed.typography]);
|
|
||||||
return (
|
return (
|
||||||
<Dynamic
|
<Dynamic
|
||||||
ref={managed.ref}
|
ref={managed.ref}
|
||||||
component={managed.component ?? "span"}
|
component={managed.component ?? "span"}
|
||||||
class={classes()}
|
class={`${managed.class} ${managed.typography}`}
|
||||||
{...passthough}
|
{...passthough}
|
||||||
></Dynamic>
|
></Dynamic>
|
||||||
);
|
);
|
||||||
|
|
|
@ -38,6 +38,16 @@
|
||||||
flex-flow: column nowrap;
|
flex-flow: column nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bot-mark {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.display-name {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
table.acct-fields {
|
table.acct-fields {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,12 @@ import {
|
||||||
PlaylistAdd,
|
PlaylistAdd,
|
||||||
Send,
|
Send,
|
||||||
Share,
|
Share,
|
||||||
|
SmartToy,
|
||||||
|
SmartToySharp,
|
||||||
Translate,
|
Translate,
|
||||||
Verified,
|
Verified,
|
||||||
} from "@suid/icons-material";
|
} from "@suid/icons-material";
|
||||||
import { Title } from "../material/typography";
|
import { Body2, Title } from "../material/typography";
|
||||||
import { useNavigate, useParams } from "@solidjs/router";
|
import { useNavigate, useParams } from "@solidjs/router";
|
||||||
import { useSessionForAcctStr } from "../masto/clients";
|
import { useSessionForAcctStr } from "../masto/clients";
|
||||||
import { resolveCustomEmoji } from "../masto/toot";
|
import { resolveCustomEmoji } from "../masto/toot";
|
||||||
|
@ -400,15 +402,21 @@ const Profile: Component = () => {
|
||||||
}}
|
}}
|
||||||
></Avatar>
|
></Avatar>
|
||||||
<div class="name-grp">
|
<div class="name-grp">
|
||||||
<span
|
<div class="display-name">
|
||||||
ref={(e) =>
|
<Show when={profile()?.bot}>
|
||||||
|
<SmartToySharp class="bot-mark" aria-label="Bot" />
|
||||||
|
</Show>
|
||||||
|
<Body2
|
||||||
|
component="span"
|
||||||
|
ref={(e: HTMLElement) =>
|
||||||
createRenderEffect(() => (e.innerHTML = displayName()))
|
createRenderEffect(() => (e.innerHTML = displayName()))
|
||||||
}
|
}
|
||||||
aria-label="Display name"
|
aria-label="Display name"
|
||||||
></span>
|
></Body2>
|
||||||
|
</div>
|
||||||
<span aria-label="Complete username">{fullUsername()}</span>
|
<span aria-label="Complete username">{fullUsername()}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div role="presentation">
|
||||||
<Switch>
|
<Switch>
|
||||||
<Match
|
<Match
|
||||||
when={
|
when={
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {
|
||||||
StarOutline,
|
StarOutline,
|
||||||
Bookmark,
|
Bookmark,
|
||||||
Share,
|
Share,
|
||||||
|
SmartToySharp,
|
||||||
} from "@suid/icons-material";
|
} from "@suid/icons-material";
|
||||||
import { useTimeSource } from "../platform/timesrc.js";
|
import { useTimeSource } from "../platform/timesrc.js";
|
||||||
import { resolveCustomEmoji } from "../masto/toot.js";
|
import { resolveCustomEmoji } from "../masto/toot.js";
|
||||||
|
@ -151,8 +152,12 @@ function TootAuthorGroup(
|
||||||
<div class={tootStyle.tootAuthorGrp} {...rest}>
|
<div class={tootStyle.tootAuthorGrp} {...rest}>
|
||||||
<Img src={toot().account.avatar} class={tootStyle.tootAvatar} />
|
<Img src={toot().account.avatar} class={tootStyle.tootAvatar} />
|
||||||
<div class={tootStyle.tootAuthorNameGrp}>
|
<div class={tootStyle.tootAuthorNameGrp}>
|
||||||
|
<div class={tootStyle.tootAuthorNamePrimary}>
|
||||||
|
<Show when={toot().account.bot}>
|
||||||
|
<SmartToySharp class="bot-mark" aria-label="Bot" />
|
||||||
|
</Show>
|
||||||
<Body2
|
<Body2
|
||||||
class={tootStyle.tootAuthorNamePrimary}
|
component="span"
|
||||||
ref={(e: { innerHTML: string }) => {
|
ref={(e: { innerHTML: string }) => {
|
||||||
createRenderEffect(() => {
|
createRenderEffect(() => {
|
||||||
e.innerHTML = resolveCustomEmoji(
|
e.innerHTML = resolveCustomEmoji(
|
||||||
|
@ -162,6 +167,7 @@ function TootAuthorGroup(
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<time datetime={toot().createdAt}>
|
<time datetime={toot().createdAt}>
|
||||||
{formatRelative(toot().createdAt, managed.now, {
|
{formatRelative(toot().createdAt, managed.now, {
|
||||||
locale: dateFnLocale(),
|
locale: dateFnLocale(),
|
||||||
|
|
|
@ -49,10 +49,7 @@
|
||||||
.tootAuthorNameGrp {
|
.tootAuthorNameGrp {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr auto;
|
grid-template-columns: 1fr auto;
|
||||||
|
|
||||||
>* {
|
|
||||||
color: var(--tutu-color-secondary-text-on-surface);
|
color: var(--tutu-color-secondary-text-on-surface);
|
||||||
}
|
|
||||||
|
|
||||||
> :last-child {
|
> :last-child {
|
||||||
grid-column: 1 /3;
|
grid-column: 1 /3;
|
||||||
|
@ -70,7 +67,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.tootAuthorNamePrimary {
|
.tootAuthorNamePrimary {
|
||||||
color: revert;
|
color: var(--tutu-color-on-surface);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
> :global(.bot-mark) {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tootAvatar {
|
.tootAvatar {
|
||||||
|
|
Loading…
Reference in a new issue