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 - chore: various nitpicks #801

Merged
merged 8 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/customerCases/customerCase/CustomerCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export default function CustomerCase({ customerCase }: CustomerCaseProps) {
<RichText value={section.richText} />
) : (
<div className={styles.imageBlockWrapper}>
{section.images.map((image) => (
{section.images?.map((image) => (
<div
key={image._key}
key={image._key ?? `${section._key}-${image.alt}`}
className={styles.imageBlockImageWrapper}
>
<div className={styles.imageBlockImageContent}>
Expand Down
5 changes: 4 additions & 1 deletion src/components/richText/RichText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ const GroupedBlogText = ({ value }: GroupedBlogTextProps) => {

// Render h2 titles, h3 subtitles, and paragraphs within a div wrapper for other groups
return (
<div key={index} className={styles.paragraph}>
<div
key={group.title?._key ?? `group-${index}`}
className={styles.paragraph}
>
{group.title && (
<PortableText
value={[group.title]}
Expand Down
6 changes: 3 additions & 3 deletions src/components/text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type TextType =
| "small"
| "caption";

const elementMap: { [key in TextType]: string } = {
const elementMap: { [key in TextType]: keyof JSX.IntrinsicElements } = {
display: "h1",
h1: "h1",
h2: "h2",
Expand Down Expand Up @@ -46,8 +46,8 @@ const Text = ({
id?: string;
className?: string;
}) => {
const Element = elementMap[type] as keyof JSX.IntrinsicElements;
const generatedClassName = `${classMap[type]} ${className ? className : ""}`;
const Element = elementMap[type];
const generatedClassName = `${classMap[type]} ${className ?? ""}`;

return (
<Element className={generatedClassName} id={id}>
Expand Down
2 changes: 1 addition & 1 deletion studio/studioConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SUPPORTED_LANGUAGES_QUERY = `*[_type == "languageSettings" && !(_id in pat
const config: WorkspaceOptions = {
name: "studio",
title: "Studio",
subtitle: "Our Own Space",
subtitle: "Variant Norge",
icon: () => <StudioIcon variant="studio" />,
basePath: "/studio",
projectId,
Expand Down