Skip to content

Commit

Permalink
Merge branch 'v3' into v3-fetch-languages
Browse files Browse the repository at this point in the history
  • Loading branch information
anemne committed Sep 26, 2024
2 parents a57d06c + 9458155 commit 46afcbc
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 74 deletions.
156 changes: 97 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
"@sanity/preview-url-secret": "^1.6.11",
"@sanity/react-loader": "^1.9.15",
"@sanity/vision": "^3.39.1",
"next": "14.2.3",
"next": "^14.2.13",
"next-sanity": "^7.1.4",
"next-sanity-image": "^6.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-focus-on": "^3.9.3",
"sanity": "^3.57.3",
"sanity-plugin-internationalized-array": "^3.0.1",
"sanity-plugin-media": "^2.3.2"
},
"devDependencies": {
Expand Down
30 changes: 16 additions & 14 deletions studio/schemas/objects/link.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { StringInputProps, defineField } from "sanity";
import { defineField } from "sanity";

import AnchorSelect from "studio/components/AnchorSelect";
import LinkTypeSelector from "studio/components/LinkTypeSelector";
import NewTabSelector from "studio/components/NewTabSelector";
import { StringInputWithCharacterCount } from "studio/components/stringInputWithCharacterCount/StringInputWithCharacterCount";

export const linkID = "link";

Expand All @@ -27,22 +26,25 @@ const lazyBlogID = () => "blog";
const lazyCompensationsID = () => "compensations";
const lazyCustomerCasesPageID = () => "customerCasesPage";

const linkTitle = defineField({
name: "linkTitle",
title: "Provide a link title",
type: "string",
description: "Enter the link text that will be displayed on the website.",
validation: (rule) => rule.max(60),
// adding custom components changes the internationalizedArrayString UI
// components: {
// input: (props: StringInputProps) =>
// StringInputWithCharacterCount({ ...props, maxCount: 60 }),
// },
});

export const link = defineField({
name: linkID,
title: "Link",
type: "object",
fields: [
{
name: "linkTitle",
title: "Provide a link title",
type: "string",
description: "Enter the link text that will be displayed on the website.",
validation: (rule) => rule.max(60),
components: {
input: (props: StringInputProps) =>
StringInputWithCharacterCount({ ...props, maxCount: 60 }),
},
},
{ ...linkTitle, type: "internationalizedArrayString" },
{
name: "linkType",
title: "What type of link is this?",
Expand Down Expand Up @@ -191,7 +193,7 @@ export const link = defineField({
prepare(selection) {
const { title, type } = selection;
return {
title: title,
title: title[0].value,
subtitle: type ? type.charAt(0).toUpperCase() + type.slice(1) : "",
};
},
Expand Down

0 comments on commit 46afcbc

Please sign in to comment.