diff options
| author | Elad Rosenheim <eladroz@users.noreply.github.com> | 2024-04-23 19:48:09 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-23 19:48:09 +0300 |
| commit | 6eb143cda881ba4dd26ab84bd85673f0fe94c1b8 (patch) | |
| tree | d946a3b4b567f0ee2590c9b45d3e2673db89626f /src/pages/blobs | |
| parent | e028782c14356a5efaaa72b01cf34c30a4357df6 (diff) | |
Support disabling uploads + fonts fix (#11)
* Inline Netlify logo, preload fonts
* Support disabling blobs upload + fonts fix
Diffstat (limited to 'src/pages/blobs')
| -rw-r--r-- | src/pages/blobs/_components/NewShape.tsx | 4 | ||||
| -rw-r--r-- | src/pages/blobs/index.astro | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/pages/blobs/_components/NewShape.tsx b/src/pages/blobs/_components/NewShape.tsx index 05f9e6f..a141177 100644 --- a/src/pages/blobs/_components/NewShape.tsx +++ b/src/pages/blobs/_components/NewShape.tsx @@ -1,7 +1,7 @@ import { useState, useEffect } from 'react'; import type { Dispatch, SetStateAction } from 'react'; import ShapePreview from './ShapePreview.tsx'; -import { generateBlob } from '../../../utils'; +import { generateBlob, uploadDisabled } from '../../../utils'; import type { BlobProps } from '../../../types.ts'; interface Props { @@ -51,7 +51,7 @@ export default function NewShape(props: Props) { <button className="btn btn-primary" onClick={randomizeBlob}> Randomize </button> - <button className="btn btn-primary" onClick={uploadBlob} disabled={wasUploaded || !blobData}> + <button className="btn btn-primary" onClick={uploadBlob} disabled={uploadDisabled || wasUploaded || !blobData}> Upload </button> </div> diff --git a/src/pages/blobs/index.astro b/src/pages/blobs/index.astro index 5630d6b..11aa98a 100644 --- a/src/pages/blobs/index.astro +++ b/src/pages/blobs/index.astro @@ -2,6 +2,8 @@ import Layout from '../../layouts/Layout.astro'; import Markdown from '../../components/Markdown.astro'; import ShapeEditor from './_components/ShapeEditor.tsx'; +import { uploadDisabled } from '../../utils'; +import ContextAlert from '../../components/ContextAlert.astro'; const explainer = ` [Netlify Blobs](https://docs.netlify.com/blobs/overview/) provides an object store for any kind of data, be it JSON, binary, @@ -9,9 +11,22 @@ or [really](https://mk.gg/projects/chalkstream) anything else ([really!](https:/ Below is an Astro island with a React component for editing, uploading and viewing blobs to the blob store 🙂. `; + +const uploadDisabledText = ` +User uploads are disabled in this site. To run your own and try it out: +<a href="https://app.netlify.com/start/deploy?repository=https://github.com/netlify-templates/astro-platform-starter"> +<img src="https://www.netlify.com/img/deploy/button.svg" style="display: inline;" alt="Deploy to Netlify" /> +</a> +`; --- <Layout title="Blobs"> + <ContextAlert + addedChecksFunction={() => { + return uploadDisabled ? uploadDisabledText : null; + }} + class="mb-6" + /> <h1 class="mb-8">Blobs x Blobs</h1> <Markdown content={explainer} class="mb-12" /> <ShapeEditor client:load /> |
