Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 - Added OpenSharedButton component for opening shared studio #533

Merged
merged 15 commits into from
Sep 2, 2024
Merged
4 changes: 4 additions & 0 deletions public/arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions studio/components/CustomToolMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ToolMenuProps } from "sanity";
import { Inline } from "@sanity/ui";
import { LinkButton } from "./linkButton/LinkButton";

export default function CustomToolMenu(props: ToolMenuProps) {
return (
<Inline>
{props.renderDefault(props)}
<LinkButton value="/shared" />
anemne marked this conversation as resolved.
Show resolved Hide resolved
</Inline>
);
}
14 changes: 14 additions & 0 deletions studio/components/linkButton/LinkButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ArrowRightIcon } from "@sanity/icons";
import styles from "./linkButton.module.css";

interface LinkButtonProps {
value?: string;
}

export const LinkButton = ({ value }: LinkButtonProps) => {
return (
<a className={styles.wrapper} href={value}>
<span className={styles.text}>Shared Studio</span>
</a>
);
};
34 changes: 34 additions & 0 deletions studio/components/linkButton/linkButton.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.wrapper {
align-items: center;
display: block;
list-style: none;
text-decoration: none;
white-space: nowrap;
border-radius: 3px;
padding: 0.2rem 0.5rem;
}

.wrapper:hover {
background: #f5f5f7;
anemne marked this conversation as resolved.
Show resolved Hide resolved
}

.text {
display: flex;
align-items: center;
text-decoration: block;
font-weight: 500;
color: #323545;
letter-spacing: 0;
font-size: 13px;
gap: 0.2rem;
line-height: 19px;

&::after {
content: "";
width: 1rem;
height: 1rem;
-webkit-mask: url("/arrow-right.svg") no-repeat;
-webkit-mask-size: contain;
background-color: #323545;
}
}
8 changes: 7 additions & 1 deletion studio/sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@
*/

import { visionTool } from "@sanity/vision";
import { defineConfig } from "sanity";
import { defineConfig, StudioToolMenu } from "sanity";
import { presentationTool } from "sanity/presentation";
import { structureTool } from "sanity/structure";

// Go to https://www.sanity.io/docs/api-versioning to learn how API versioning works
import { apiVersion, dataset, projectId } from "./env";
import { schema } from "./schema";
import deskStructure from "./schemas/deskStructure";
import CustomToolMenu from "./components/CustomToolMenu";

export default defineConfig({
basePath: "/studio",
projectId,
dataset,
// Add and edit the content schema in the './studio/schema' folder
schema,
studio: {
components: {
toolMenu: CustomToolMenu,
},
},
plugins: [
structureTool({
structure: deskStructure,
Expand Down