From be4de751ad432f8230d83e1d6cbb3e56d608cd58 Mon Sep 17 00:00:00 2001 From: TomasBankauskas Date: Tue, 9 Apr 2024 13:44:24 +0300 Subject: updates --- src/components/ContextAlert.astro | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/components/ContextAlert.astro (limited to 'src/components/ContextAlert.astro') diff --git a/src/components/ContextAlert.astro b/src/components/ContextAlert.astro new file mode 100644 index 0000000..ed54565 --- /dev/null +++ b/src/components/ContextAlert.astro @@ -0,0 +1,28 @@ +--- +import Alert from './Alert.astro'; +import Markdown from './Markdown.astro'; +import { getNetlifyContext } from '../utils'; + +const noNetlifyContextAlert = ` +For full functionality, either run this site locally via \`netlify dev\` +([see docs](https://docs.netlify.com/cli/local-development/")) or deploy it to Netlify. +`; + +const { addedChecksFunction, class: className } = Astro.props; +const ctx = getNetlifyContext(); + +let markdownText = null; +if (!ctx) { + markdownText = noNetlifyContextAlert; +} else if (addedChecksFunction) { + markdownText = addedChecksFunction(ctx); +} +--- + +{ + markdownText && ( + + + + ) +} -- cgit v1.2.3