mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-06 08:38:37 +00:00
feature: frontend link embed spoiler implementation
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
.embed {
|
.embed {
|
||||||
margin: 0.2em 0;
|
margin: 0.2em 0;
|
||||||
|
position: relative;
|
||||||
iframe {
|
iframe {
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
@@ -135,3 +135,20 @@
|
|||||||
grid-area: open;
|
grid-area: open;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spoiler_container {
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
width:100%;
|
||||||
|
background:var(--primary-header);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
top:0;
|
||||||
|
left:0;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spoiler_title{
|
||||||
|
text-align: center;
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import { MessageAreaWidthContext } from "../../../../pages/channels/messaging/Me
|
|||||||
import Markdown from "../../../markdown/Markdown";
|
import Markdown from "../../../markdown/Markdown";
|
||||||
import Attachment from "../attachments/Attachment";
|
import Attachment from "../attachments/Attachment";
|
||||||
import EmbedMedia from "./EmbedMedia";
|
import EmbedMedia from "./EmbedMedia";
|
||||||
|
import EmbedSpoiler from "./EmbedSpoiler";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
embed: API.Embed;
|
embed: API.Embed;
|
||||||
@@ -104,7 +105,7 @@ export default function Embed({ embed }: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(styles.embed, styles.website)}
|
className={classNames(styles.embed, styles.website, embed.spoiler ? styles.spoiler : null)}
|
||||||
style={{
|
style={{
|
||||||
borderInlineStartColor:
|
borderInlineStartColor:
|
||||||
embed.colour ?? "var(--tertiary-background)",
|
embed.colour ?? "var(--tertiary-background)",
|
||||||
@@ -162,6 +163,10 @@ export default function Embed({ embed }: Props) {
|
|||||||
<Attachment attachment={embed.media!} />
|
<Attachment attachment={embed.media!} />
|
||||||
) : (
|
) : (
|
||||||
<EmbedMedia embed={embed} height={height} />
|
<EmbedMedia embed={embed} height={height} />
|
||||||
|
|
||||||
|
))}
|
||||||
|
{(embed.spoiler && (
|
||||||
|
<EmbedSpoiler/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
{!largeMedia && embed.type === "Website" && (
|
{!largeMedia && embed.type === "Website" && (
|
||||||
@@ -175,8 +180,12 @@ export default function Embed({ embed }: Props) {
|
|||||||
}
|
}
|
||||||
height={height}
|
height={height}
|
||||||
/>
|
/>
|
||||||
|
{embed.spoiler && (
|
||||||
|
<EmbedSpoiler/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/components/common/messaging/embed/EmbedSpoiler.tsx
Normal file
11
src/components/common/messaging/embed/EmbedSpoiler.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import classNames from "classnames";
|
||||||
|
import { API } from "revolt.js";
|
||||||
|
import styles from "./Embed.module.scss";
|
||||||
|
|
||||||
|
export default function EmbedSpoiler(){
|
||||||
|
return (
|
||||||
|
<div className={classNames(styles.spoiler_container)}>
|
||||||
|
<h1 className={classNames(styles.spoiler_title)}>SPOILER</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user