diff --git a/src/components/Button.astro b/src/components/Button.astro new file mode 100644 index 0000000..53cef09 --- /dev/null +++ b/src/components/Button.astro @@ -0,0 +1,36 @@ +--- +interface Props { + value: string; + as?: 'a'|'input'; + href?: string; +} + +const { as = 'a', value, href } = Astro.props; +--- +{as === 'a' ? ( + {value} +) : ( + +)} + \ No newline at end of file diff --git a/src/components/Footer.astro b/src/components/Footer.astro new file mode 100644 index 0000000..c0192e0 --- /dev/null +++ b/src/components/Footer.astro @@ -0,0 +1,44 @@ +--- +import { GithubIcon } from "./GithubIcon"; +--- + + + diff --git a/src/components/GaugeIcon.module.css b/src/components/GaugeIcon.module.css new file mode 100644 index 0000000..51df517 --- /dev/null +++ b/src/components/GaugeIcon.module.css @@ -0,0 +1,4 @@ +.gauge { + color: currentColor; + stroke-width: 2; +} diff --git a/src/components/GaugeIcon.tsx b/src/components/GaugeIcon.tsx new file mode 100644 index 0000000..a6cf7c4 --- /dev/null +++ b/src/components/GaugeIcon.tsx @@ -0,0 +1,21 @@ +import classes from "./GaugeIcon.module.css"; + +export const GaugeIcon = () => { + return ( + + + + + ); +}; diff --git a/src/components/GithubIcon.module.css b/src/components/GithubIcon.module.css new file mode 100644 index 0000000..fde0a89 --- /dev/null +++ b/src/components/GithubIcon.module.css @@ -0,0 +1,4 @@ +.github { + color: currentColor; + stroke-width: 2; +} diff --git a/src/components/GithubIcon.tsx b/src/components/GithubIcon.tsx new file mode 100644 index 0000000..7fbff0b --- /dev/null +++ b/src/components/GithubIcon.tsx @@ -0,0 +1,20 @@ +import classes from "./GaugeIcon.module.css"; +export const GithubIcon = () => { + return ( + + + + + ); +}; diff --git a/src/components/SmallHeader.astro b/src/components/SmallHeader.astro new file mode 100644 index 0000000..684eb7c --- /dev/null +++ b/src/components/SmallHeader.astro @@ -0,0 +1,24 @@ +--- +import { GaugeIcon } from "./GaugeIcon"; +--- +

Cruise CONTROL

+ \ No newline at end of file diff --git a/src/components/VideoPlayer.module.css b/src/components/VideoPlayer.module.css index 64118a3..eccb012 100644 --- a/src/components/VideoPlayer.module.css +++ b/src/components/VideoPlayer.module.css @@ -25,8 +25,9 @@ background: transparent; cursor: pointer; - width: calc(100% - 1rem); - margin: 0; + /* width: calc(100% - 2.25rem); */ + width: 100%; + margin: 1rem 0 0 0; /* Removes default focus */ &:focus { @@ -63,7 +64,7 @@ /******** Firefox styles ********/ /* slider track */ &::-moz-range-track { - background-color: rgb(var(--accent-dark)); + background-color: rgb(var(--accent-dark), 25%); border-radius: 0.5rem; height: 0.5rem; } @@ -74,9 +75,10 @@ border-radius: 0; /*Removes default border-radius that FF applies*/ /*custom styles*/ - background-color: rgb(var(--accent-dark)); + background: var(--accent-gradient); height: 2rem; - width: 1rem; + width: 2rem; + border-radius: 50%; } &:focus::-moz-range-thumb { @@ -92,7 +94,10 @@ justify-content: space-between; width: 100%; - option { + & div { padding: 0; + flex: 1; + text-align: center; + min-width: 0; } } diff --git a/src/components/VideoPlayer.tsx b/src/components/VideoPlayer.tsx index 23a5c41..418a341 100644 --- a/src/components/VideoPlayer.tsx +++ b/src/components/VideoPlayer.tsx @@ -34,6 +34,16 @@ const tryGetVideoUrl = (urlInput: string | null) => { return urlInput; } + if (urlInput.startsWith("https://youtu.be")) { + // regex to extract the video ID from: https://youtu.be/sjgtpKxhZa4?si=lhbg5O4yeHiABClV + const videoId = urlInput.match( + /(?:\?v=|&v=|youtu\.be\/)(.*?)(?:\?|$)/, + )?.[1]; + if (videoId) { + urlInput = videoId; + } + } + const fallback = new URL("https://www.youtube.com/watch"); fallback.searchParams.set("v", urlInput); return fallback.href; @@ -72,14 +82,19 @@ export const VideoPlayer = () => { onChange={handleSpeedChange} value={speed} /> - - - - - - - - +
+
50%
+
+
60%
+
+
70%
+
+
80%
+
+
90%
+
+
100%
+
); }; diff --git a/src/pages/index.astro b/src/pages/index.astro index 5bde07d..1e2e289 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,5 +1,7 @@ --- import Layout from "../layouts/Layout.astro"; +import Button from "../components/Button.astro"; +import Footer from "../components/Footer.astro"; --- @@ -22,8 +24,9 @@ import Layout from "../layouts/Layout.astro"; placeholder="Enter URL or Video ID" required /> - +