TootComposer: remove css module

This commit is contained in:
thislight 2024-11-09 16:56:18 +08:00
parent cd1ae210e7
commit 44860a5bb2
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E
3 changed files with 24 additions and 17 deletions

View file

@ -0,0 +1,12 @@
.TootComposer {
--card-gut: 8px;
.reply-input {
display: flex;
align-items: flex-start;
gap: 8px;
}
}

View file

@ -1,11 +0,0 @@
.composer {
composes: card from "../material/cards.module.css";
--card-gut: 8px;
}
.replyInput {
display: flex;
align-items: flex-start;
gap: 8px;
}

View file

@ -5,6 +5,7 @@ import {
createUniqueId, createUniqueId,
onMount, onMount,
Show, Show,
type Accessor,
type Component, type Component,
type JSX, type JSX,
type Ref, type Ref,
@ -35,7 +36,7 @@ import {
Translate, Translate,
} from "@suid/icons-material"; } from "@suid/icons-material";
import type { Account } from "../accounts/stores"; import type { Account } from "../accounts/stores";
import tootComposers from "./TootComposer.module.css"; import "./TootComposer.css";
import { makeEventListener } from "@solid-primitives/event-listener"; import { makeEventListener } from "@solid-primitives/event-listener";
import BottomSheet from "../material/BottomSheet"; import BottomSheet from "../material/BottomSheet";
import { useLanguage } from "../platform/i18n"; import { useLanguage } from "../platform/i18n";
@ -196,6 +197,10 @@ function randomChoose<T extends any[]>(
return K[idx]; return K[idx];
} }
function useRandomChoice<T>(choices: () => T[]): Accessor<T> {
return createMemo(() => randomChoose(Math.random(), choices()));
}
function cancelEvent(event: Event) { function cancelEvent(event: Event) {
event.stopPropagation(); event.stopPropagation();
} }
@ -224,9 +229,10 @@ const TootComposer: Component<{
const [langPickerOpen, setLangPickerOpen] = createSignal(false); const [langPickerOpen, setLangPickerOpen] = createSignal(false);
const appLanguage = useLanguage(); const appLanguage = useLanguage();
const randomPlaceholder = createMemo(() => const randomPlaceholder = useRandomChoice(() => [
randomChoose(Math.random(), ["What's happening?", "What do your think?"]), "What's happening?",
); "What do you think?",
]);
createEffect(() => { createEffect(() => {
const lang = appLanguage().split("-")[0]; const lang = appLanguage().split("-")[0];
@ -311,7 +317,7 @@ const TootComposer: Component<{
return ( return (
<div <div
ref={props.ref} ref={props.ref}
class={tootComposers.composer} class={/* @once */ `TootComposer ${cardStyles.card}`}
style={containerStyle()} style={containerStyle()}
onClick={() => { onClick={() => {
inputRef.focus(); inputRef.focus();
@ -323,7 +329,7 @@ const TootComposer: Component<{
on:touchmove={cancelEvent} on:touchmove={cancelEvent}
on:wheel={cancelEvent} on:wheel={cancelEvent}
> >
<div class={tootComposers.replyInput}> <div class="reply-input">
<Show when={props.profile}> <Show when={props.profile}>
<Avatar <Avatar
src={props.profile!.inf?.avatar} src={props.profile!.inf?.avatar}