From 2a263d70331f0804dfdcd5e26b58a9edcec62fff Mon Sep 17 00:00:00 2001 From: Marcus Forsberg Date: Tue, 11 Jun 2024 16:42:07 +0200 Subject: [PATCH] fix(pathname): hide Preview button when outside of Presentation tool (eg. in Structure tool) (#68) * fix(pathname): hide Preview button when outside of Presentation tool (eg. in Structure tool) * chore: changeset --- .changeset/fluffy-phones-explain.md | 5 ++++ .../src/components/PathnameFieldComponent.tsx | 30 +++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 .changeset/fluffy-phones-explain.md diff --git a/.changeset/fluffy-phones-explain.md b/.changeset/fluffy-phones-explain.md new file mode 100644 index 00000000..d75d2795 --- /dev/null +++ b/.changeset/fluffy-phones-explain.md @@ -0,0 +1,5 @@ +--- +"@tinloof/sanity-studio": patch +--- + +Hide the "Preview" button from the `pathname` field when used in the Structure Tool (where it has no effect). diff --git a/packages/sanity-studio/src/components/PathnameFieldComponent.tsx b/packages/sanity-studio/src/components/PathnameFieldComponent.tsx index b5ce2b64..35c1a0db 100644 --- a/packages/sanity-studio/src/components/PathnameFieldComponent.tsx +++ b/packages/sanity-studio/src/components/PathnameFieldComponent.tsx @@ -423,21 +423,21 @@ function PreviewButton({ localizedPathname }: { localizedPathname: string }) { }, [navigate, localizedPathname]); return ( -