summaryrefslogtreecommitdiff
path: root/src/pages/blobs/_components/ShapePreview.tsx
diff options
context:
space:
mode:
authorElad Rosenheim <eladroz@users.noreply.github.com>2024-04-23 17:55:24 +0300
committerGitHub <noreply@github.com>2024-04-23 17:55:24 +0300
commit7e40aa188979311e706154dfcf52e47975f99cde (patch)
tree1368cc922524b5b1eb7eef4684fccab0fbc3628d /src/pages/blobs/_components/ShapePreview.tsx
parent5396de306695226c939384598410761297739fef (diff)
Revalidation & Blobs pages, tweaks (#8)
* added blobs.astro page * updated blobs * updated index.astro and npm dependencies * updated api blobs * Revalidation example WIP * Revalidation by tag example * Update revalidation.astro * Image CDN fixes * Text fixes * updated colors (#9) * updated colors * updated README.md * updated Layout.astro bg color * updated template colors * Inline Inter font * Inline noise.png * Remove remaining "Astro.js" --------- Co-authored-by: TomasBankauskas <tbdizainas@gmail.com>
Diffstat (limited to 'src/pages/blobs/_components/ShapePreview.tsx')
-rw-r--r--src/pages/blobs/_components/ShapePreview.tsx19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pages/blobs/_components/ShapePreview.tsx b/src/pages/blobs/_components/ShapePreview.tsx
new file mode 100644
index 0000000..a00d2bc
--- /dev/null
+++ b/src/pages/blobs/_components/ShapePreview.tsx
@@ -0,0 +1,19 @@
+import { randomInt } from '../../../utils.ts';
+import type { BlobProps } from '../../../types.ts';
+
+export default function ShapePreview(props: BlobProps) {
+ const { svgPath, parameters } = props;
+ const gradientId = `gradient-${randomInt(10_000_000, 100_000_000)}`;
+
+ return (
+ <svg viewBox={`0 0 ${parameters.size} ${parameters.size}`} xmlns="http://www.w3.org/2000/svg" width="100%">
+ <defs>
+ <linearGradient id={gradientId} x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="0%" style={{ stopColor: parameters.colors[0] }} />
+ <stop offset="100%" style={{ stopColor: parameters.colors[1] }} />
+ </linearGradient>
+ </defs>
+ <path d={svgPath} fill={`url(#${gradientId})`}></path>
+ </svg>
+ );
+}