Skip to content

Commit

Permalink
v3 - Added tab for opening shared studio (#533)
Browse files Browse the repository at this point in the history
* Add OpenSharedButton component for opening shared studio

* Prettier fix

* Update studio/schemas/documents/blog.ts

Co-authored-by: christinaroise <[email protected]>

* Update studio/components/OpenSharedButton.tsx

Co-authored-by: christinaroise <[email protected]>

* Rename OpenSharedButton with OpenSharedLink in blog schema

* Rename opensharedlink to linkbutton and added style to link

* Prettier

* added border and round corners to button

* Add shared studio in navigationbar

* Removed module.css file for customToolMenu

* Prettier fix

* Pretty

* removed link from blog

* refactor: Rename CustomLink component property to 'component'

* moved arrow icon to css file for a11y

---------

Co-authored-by: christinaroise <[email protected]>
  • Loading branch information
anemne and christinaroise authored Sep 2, 2024
1 parent 9825d7c commit c48a1c7
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 1 deletion.
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" />
</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;
}

.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

0 comments on commit c48a1c7

Please sign in to comment.