Compare commits

..

No commits in common. "d2df08f1408890f8b048ccc1eb4c9b69b2b2952d" and "9d720d31b4581de238cd9e248a67c5be024cf729" have entirely different histories.

8 changed files with 37 additions and 64 deletions

View file

@ -1,6 +1,5 @@
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.
@ -11,15 +10,12 @@ 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;

View file

@ -10,6 +10,7 @@
} }
.button { .button {
composes: buttonText from "./typography.module.css";
composes: touchTarget; composes: touchTarget;
border: none; border: none;

View file

@ -29,11 +29,12 @@
font-size: var(--subheading-size); font-size: var(--subheading-size);
} }
.body1, .body2 { .body1 {
font-size: var(--body-size); font-size: var(--body-size);
} }
.body2 { .body2 {
composes: body1;
font-weight: var(--body2-weight); font-weight: var(--body2-weight);
} }

View file

@ -1,6 +1,7 @@
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.css"; import typography from "./typography.module.css";
import { mergeClass } from "../utils";
type AnyElement = keyof JSX.IntrinsicElements | ParentComponent<any>; type AnyElement = keyof JSX.IntrinsicElements | ParentComponent<any>;
@ -39,11 +40,13 @@ 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={`${managed.class} ${managed.typography}`} class={classes()}
{...passthough} {...passthough}
></Dynamic> ></Dynamic>
); );

View file

@ -38,16 +38,6 @@
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;

View file

@ -38,12 +38,10 @@ import {
PlaylistAdd, PlaylistAdd,
Send, Send,
Share, Share,
SmartToy,
SmartToySharp,
Translate, Translate,
Verified, Verified,
} from "@suid/icons-material"; } from "@suid/icons-material";
import { Body2, Title } from "../material/typography"; import { 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";
@ -402,21 +400,15 @@ const Profile: Component = () => {
}} }}
></Avatar> ></Avatar>
<div class="name-grp"> <div class="name-grp">
<div class="display-name"> <span
<Show when={profile()?.bot}> ref={(e) =>
<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"
></Body2> ></span>
</div>
<span aria-label="Complete username">{fullUsername()}</span> <span aria-label="Complete username">{fullUsername()}</span>
</div> </div>
<div role="presentation"> <div>
<Switch> <Switch>
<Match <Match
when={ when={

View file

@ -20,7 +20,6 @@ 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";
@ -152,12 +151,8 @@ 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
component="span" class={tootStyle.tootAuthorNamePrimary}
ref={(e: { innerHTML: string }) => { ref={(e: { innerHTML: string }) => {
createRenderEffect(() => { createRenderEffect(() => {
e.innerHTML = resolveCustomEmoji( e.innerHTML = resolveCustomEmoji(
@ -167,7 +162,6 @@ 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(),

View file

@ -49,7 +49,10 @@
.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;
@ -67,14 +70,7 @@
} }
.tootAuthorNamePrimary { .tootAuthorNamePrimary {
color: var(--tutu-color-on-surface); color: revert;
display: flex;
align-items: center;
gap: 4px;
> :global(.bot-mark) {
font-size: 1.2em;
}
} }
.tootAvatar { .tootAvatar {