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 all 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
2 changes: 1 addition & 1 deletion src/components/customerCases/customerCase/CustomerCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function CustomerCase({ customerCase }: CustomerCaseProps) {
<div className={styles.imageBlockWrapper}>
{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
8 changes: 0 additions & 8 deletions src/components/text/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const meta: Meta<typeof Text> = {
"h4",
"h5",
"h6",
"h7",
"labelSmall",
"labelLight",
"labelRegular",
Expand Down Expand Up @@ -94,13 +93,6 @@ export const H6: Story = {
},
};

export const H7: Story = {
args: {
type: "h7",
children: "This is an H7 text",
},
};

export const LabelSmall: Story = {
args: {
type: "labelSmall",
Expand Down
9 changes: 3 additions & 6 deletions src/components/text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export type TextType =
| "h4"
| "h5"
| "h6"
| "h7"
| "desktopLink"
| "labelSmall"
| "labelLight"
Expand All @@ -25,14 +24,13 @@ export type TextType =
| "mobileH1"
| "mobileBodyNormal";

const elementMap: { [key in TextType]: string } = {
const elementMap: { [key in TextType]: keyof JSX.IntrinsicElements } = {
h1: "h1",
h2: "h2",
h3: "h3",
h4: "h4",
h5: "h5",
h6: "h6",
h7: "h7",
desktopLink: "p",
labelSmall: "p",
labelLight: "p",
Expand All @@ -57,7 +55,6 @@ const classMap: { [key in TextType]?: string } = {
h4: styles.h4,
h5: styles.h5,
h6: styles.h6,
h7: styles.h7,
desktopLink: styles.desktopLink,
labelSmall: styles.labelSmall,
labelLight: styles.labelLight,
Expand Down Expand Up @@ -86,8 +83,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
3 changes: 1 addition & 2 deletions src/components/text/text.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
.h4,
.h5,
.h6,
.h7,
.bodyXl {
color: var(--primary-black);
font-family: var(--font-britti-sans);
Expand Down Expand Up @@ -61,7 +60,7 @@
}
}

/* TODO: we need to add sizes og h4-h7 */
/* TODO: we need to add sizes og h4-h6 */

.desktopLink {
font-size: 10rem;
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