Skip to content

Commit

Permalink
feat: linkedin preview
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiiBz committed Apr 13, 2024
1 parent afc1af2 commit 98c0a7e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
5 changes: 1 addition & 4 deletions apps/dashboard/src/components/ExportModal/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface PreviewProps {
}

export function Preview({ dynamicTexts, setDynamicTexts }: PreviewProps) {
const [preview, setPreview] = useState<"x" | "linkedin" | "facebook">("x");
const [preview, setPreview] = useState<"x" | "linkedin">("x");
const elements = useElementsStore((state) => state.elements);

return (
Expand All @@ -29,9 +29,6 @@ export function Preview({ dynamicTexts, setDynamicTexts }: PreviewProps) {
<SegmentedControl.Item value="linkedin">
LinkedIn
</SegmentedControl.Item>
<SegmentedControl.Item value="facebook">
Facebook
</SegmentedControl.Item>
</SegmentedControl.Root>
</Flex>
</Flex>
Expand Down
27 changes: 22 additions & 5 deletions apps/dashboard/src/components/OgImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ interface OgImageProps {
deletable?: (event: MouseEvent<HTMLSpanElement>) => void;
size?: "small" | "medium";
client?: boolean;
preview?: "x" | "linkedin" | "facebook";
preview?: "x" | "linkedin";
}

export function OgImage({
Expand All @@ -103,11 +103,12 @@ export function OgImage({
return (
<Tag
className={clsx(
"h-[157px] w-[300px] min-w-[300px] flex items-center justify-center rounded relative group overflow-hidden",
"min-h-[157px] w-[300px] min-w-[300px] flex flex-col items-center justify-center rounded relative group overflow-hidden",
{
"h-[157px] w-[300px] min-w-[300px]": size === "small",
"h-[252px] w-[480px] min-w-[480px]": size === "medium",
"rounded-2xl": preview === "x", // X has a 16px border radius
"min-h-[157px] w-[300px] min-w-[300px]": size === "small",
"min-h-[252px] w-[480px] min-w-[480px]": size === "medium",
"rounded-2xl": preview === "x",
"rounded-md": preview === "linkedin",
},
)}
href={href ?? ""}
Expand Down Expand Up @@ -184,6 +185,22 @@ export function OgImage({
Your page title
</span>
) : null}
{preview === "linkedin" ? (
<div
className="px-3 py-2 w-full flex flex-col gap-2"
style={{ backgroundColor: "rgb(237, 243, 248)" }}
>
<span
className="text-sm font-semibold"
style={{ color: "rgba(0, 0, 0, 0.9)" }}
>
Your page title
</span>
<span className="text-xs" style={{ color: "rgba(0, 0, 0, 0.6)" }}>
website.com
</span>
</div>
) : null}
</Tag>
);
}

0 comments on commit 98c0a7e

Please sign in to comment.