From 325896837113d1c45de0dcff1972a8686730f695 Mon Sep 17 00:00:00 2001 From: Ali Abdalla Date: Fri, 9 Aug 2024 17:20:12 -0700 Subject: [PATCH] Add warning to guides and change styling of tip (#9075) * add warning and styling * add changeset * forward every trailing slash that vercel lets through * fix weird tw thing * fix error * better fix for css trailing slash issue --------- Co-authored-by: gradio-pr-bot --- .changeset/cuddly-news-stare.md | 5 ++++ .../generate_jsons/src/guides/__init__.py | 29 ++++++++++++++++++- js/_website/src/lib/assets/style.css | 24 ++++++++++++--- js/_website/svelte.config.js | 5 +++- 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 .changeset/cuddly-news-stare.md diff --git a/.changeset/cuddly-news-stare.md b/.changeset/cuddly-news-stare.md new file mode 100644 index 0000000000000..5e16183247ed1 --- /dev/null +++ b/.changeset/cuddly-news-stare.md @@ -0,0 +1,5 @@ +--- +"website": minor +--- + +feat:Add warning to guides and change styling of tip diff --git a/js/_website/generate_jsons/src/guides/__init__.py b/js/_website/generate_jsons/src/guides/__init__.py index 11ef65e01fd31..110b7f5a752ca 100644 --- a/js/_website/generate_jsons/src/guides/__init__.py +++ b/js/_website/generate_jsons/src/guides/__init__.py @@ -87,7 +87,34 @@ def get_labeled_metadata(label, is_list=True): guide_content = re.sub( r"(\n\nTip: )(.*?)(?=\n\n|$)", - lambda x: f"

✍️ Tip: {x.group(2)}

", + lambda x: f""" +

+ + + + + + Tip: + + {x.group(2)} +

+ """, + guide_content, + ) + + guide_content = re.sub( + r"(\n\nWarning: )(.*?)(?=\n\n|$)", + lambda x: f""" +

+ + + + + Warning: + + {x.group(2)} +

+ """, guide_content, ) diff --git a/js/_website/src/lib/assets/style.css b/js/_website/src/lib/assets/style.css index 92f7026296419..7fd0233556059 100644 --- a/js/_website/src/lib/assets/style.css +++ b/js/_website/src/lib/assets/style.css @@ -225,19 +225,35 @@ code.language-bash { } .tip { - @apply bg-gradient-to-br from-orange-50 to-white border-orange-50 border-l-2 border-l-orange-300 text-orange-700 p-4 px-6; + @apply bg-gradient-to-br from-green-50 to-white border-green-50 border-l-2 border-l-green-300 text-green-700 p-4 px-6; } .tip strong { - @apply text-orange-700; + @apply text-green-700; } .tip code { - @apply text-orange-700; + @apply text-green-700; } .tip a { - @apply text-orange-700; + @apply text-green-700; +} + +.warning { + @apply bg-gradient-to-br from-red-50 to-white border-red-50 border-l-2 border-l-red-300 text-red-700 p-4 px-6; +} + +.warning strong { + @apply text-red-700; +} + +.warning code { + @apply text-red-700; +} + +.warning a { + @apply text-red-700; } .shared-link:before { diff --git a/js/_website/svelte.config.js b/js/_website/svelte.config.js index dbf98a7714b88..2ccfe0b6ef368 100644 --- a/js/_website/svelte.config.js +++ b/js/_website/svelte.config.js @@ -129,7 +129,10 @@ const config = { files: { lib: "src/lib" }, - adapter: adapter() + adapter: adapter(), + paths: { + relative: false + } } };