Files
outline/shared/editor/embeds/Spotify.tsx
codegen-sh[bot]andTom Moor 758d4edbb9 Upgrade @typescript-eslint dependencies to v8.33.0 (#9363)
* Upgrade @typescript-eslint dependencies from v6.21.0 to v8.33.0

- Updated @typescript-eslint/eslint-plugin from ^6.21.0 to ^8.33.0
- Updated @typescript-eslint/parser from ^6.21.0 to ^8.33.0
- Tested linting functionality to ensure compatibility
- This brings the latest TypeScript ESLint features and bug fixes

* lint

* tsc

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-06-01 11:01:15 -04:00

43 lines
942 B
TypeScript

import * as React from "react";
import styled from "styled-components";
import Frame from "../components/Frame";
import { EmbedProps as Props } from ".";
function Spotify({ matches, ...props }: Props) {
let pathname = "";
try {
const parsed = new URL(props.attrs.href);
pathname = parsed.pathname;
} catch (_err) {
pathname = "";
}
const normalizedPath = pathname.replace(/^\/embed/, "/");
let height;
if (normalizedPath.includes("episode") || normalizedPath.includes("show")) {
height = 232;
} else if (normalizedPath.includes("track")) {
height = 80;
} else {
height = 380;
}
return (
<SpotifyFrame
{...props}
width="100%"
height={`${height}px`}
src={`https://open.spotify.com/embed${normalizedPath}`}
title="Spotify Embed"
allow="encrypted-media"
/>
);
}
const SpotifyFrame = styled(Frame)`
border-radius: 13px;
`;
export default Spotify;