-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathLinkPreview.stories.tsx
More file actions
75 lines (66 loc) · 2.15 KB
/
LinkPreview.stories.tsx
File metadata and controls
75 lines (66 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Copyright 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
import React from "react";
import { fn } from "storybook/test";
import type { Meta, StoryFn } from "@storybook/react-vite";
import imageFile from "../../../../static/element.png";
import { LinkPreview } from "./LinkPreview";
import { LinkedTextContext } from "../../../core/utils/LinkedText";
export default {
title: "EventTiles/LinkPreview",
component: LinkPreview,
tags: ["autodocs"],
args: {
onImageClick: fn(),
},
} satisfies Meta<typeof LinkPreview>;
const Template: StoryFn<typeof LinkPreview> = (args) => (
<LinkedTextContext.Provider value={{}}>
<LinkPreview {...args} />
</LinkedTextContext.Provider>
);
export const Default = Template.bind({});
Default.args = {
title: "A simple title",
description: "A simple description",
link: "https://matrix.org",
siteName: "Site name",
image: {
imageThumb: imageFile,
imageFull: imageFile,
},
};
export const Title = Template.bind({});
Title.args = {
title: "A simple title",
link: "https://matrix.org",
};
export const TitleAndDescription = Template.bind({});
TitleAndDescription.args = {
title: "A simple title",
description: "A simple description with a link to https://matrix.org",
link: "https://matrix.org",
};
export const WithTooltip = Template.bind({});
WithTooltip.args = {
title: "A simple title",
description: "A simple description",
showTooltipOnLink: true,
link: "https://matrix.org",
};
export const WithVeryLongText = Template.bind({});
WithVeryLongText.args = {
title: "GitHub - element-hq/not-a-real-repo: A very very long PR title that should be rendered nicely",
description:
"This PR doesn't actually exist and neither does the repository. It might exist one day if we go into the business of making paradoxical repository names.",
link: "https://matrix.org",
siteName: "GitHub",
image: {
imageThumb: imageFile,
imageFull: imageFile,
},
};