RegularToot: support content warning
This commit is contained in:
parent
cff0c2880a
commit
737d63f88a
3 changed files with 64 additions and 11 deletions
|
@ -5,6 +5,8 @@ import {
|
|||
type JSX,
|
||||
Show,
|
||||
createRenderEffect,
|
||||
createSignal,
|
||||
type Setter,
|
||||
} from "solid-js";
|
||||
import tootStyle from "./toot.module.css";
|
||||
import { formatRelative } from "date-fns";
|
||||
|
@ -200,6 +202,11 @@ export function findElementActionable(
|
|||
return current;
|
||||
}
|
||||
|
||||
function onToggleReveal(setValue: Setter<boolean>, event: Event) {
|
||||
event.stopPropagation();
|
||||
setValue((x) => !x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Component for a toot.
|
||||
*
|
||||
|
@ -239,6 +246,7 @@ const RegularToot: Component<TootCardProps> = (props) => {
|
|||
const status = () => managed.status;
|
||||
const toot = () => status().reblog ?? status();
|
||||
const session = useDefaultSession();
|
||||
const [reveal, setReveal] = createSignal(false);
|
||||
|
||||
css`
|
||||
.reply-sep {
|
||||
|
@ -326,6 +334,10 @@ const RegularToot: Component<TootCardProps> = (props) => {
|
|||
emojis={toot().emojis}
|
||||
mentions={toot().mentions}
|
||||
class={cardStyle.cardNoPad}
|
||||
sensitive={toot().sensitive}
|
||||
spoilerText={toot().spoilerText}
|
||||
reveal={reveal()}
|
||||
onToggleReveal={[onToggleReveal, setReveal]}
|
||||
/>
|
||||
<Show when={toot().card}>
|
||||
<PreviewCard src={toot().card!} />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue