-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #997 from varianter/v3-petterhh/openness-section
✨ Add openness section
- Loading branch information
Showing
10 changed files
with
218 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { SanityImage } from "src/components/image/SanityImage"; | ||
import SmileyBox from "src/components/smileyBox/SmileyBox"; | ||
import Text from "src/components/text/Text"; | ||
import { OpennessSection } from "studio/lib/interfaces/pages"; | ||
|
||
import styles from "./openness.module.css"; | ||
|
||
export interface OpennessProps { | ||
section: OpennessSection; | ||
} | ||
|
||
export default function Openness({ section }: OpennessProps) { | ||
return ( | ||
<div className={styles.wrapper}> | ||
<Text type={"h2"} className={styles.title}> | ||
{section.basicTitle} | ||
</Text> | ||
<div className={styles.content}> | ||
<div className={styles.image}> | ||
<SanityImage image={section.image} /> | ||
</div> | ||
<SmileyBox description={section.description} /> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: flex-start; | ||
max-width: var(--max-content-width-large); | ||
margin: 5rem auto; | ||
gap: 2rem; | ||
color: var(--text-primary); | ||
} | ||
|
||
.title { | ||
width: 40rem; | ||
color: var(--text-primary); | ||
|
||
@media (max-width: 834px) { | ||
width: 25.875rem; | ||
} | ||
|
||
@media (max-width: 425px) { | ||
width: 19.4375rem; | ||
} | ||
} | ||
|
||
.content { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: flex-start; | ||
padding: 0.25rem; | ||
gap: 1rem; | ||
|
||
@media (max-width: 768px) { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 1.5rem; | ||
} | ||
} | ||
|
||
.image { | ||
height: 30rem; | ||
|
||
& img { | ||
border-radius: 0.375rem 6rem 0.375rem 0.375rem; | ||
} | ||
|
||
@media (max-width: 834px) { | ||
height: 26.25rem; | ||
align-self: stretch; | ||
} | ||
|
||
@media (max-width: 425px) { | ||
align-self: stretch; | ||
height: 22.375; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Text from "src/components/text/Text"; | ||
|
||
import styles from "./smileyBox.module.css"; | ||
|
||
type SmileyBoxProps = { | ||
background?: "dark" | "light"; | ||
description: string; | ||
}; | ||
|
||
export default function SmileyBox({ description }: SmileyBoxProps) { | ||
return ( | ||
<div className={styles.wrapper}> | ||
<div className={styles.smiley} /> | ||
<div className={styles.description}> | ||
<Text type={"h3"}>{description}</Text> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: flex-start; | ||
height: 30rem; | ||
min-width: 19.75rem; | ||
padding: 2.25rem; | ||
border-radius: 6rem 6rem 0.375rem 0.375rem; | ||
background-color: #dafbdc; | ||
|
||
@media (max-width: 834px) { | ||
align-self: stretch; | ||
height: 26.25rem; | ||
} | ||
|
||
@media (max-width: 425px) { | ||
align-self: stretch; | ||
height: 26.25rem; | ||
min-width: 19.4375rem; | ||
} | ||
} | ||
|
||
.smiley { | ||
&::before { | ||
content: ""; | ||
display: block; | ||
width: 4.86119rem; | ||
height: 4.86119rem; | ||
-webkit-mask: url("/_assets/happy-smiley-face.svg") no-repeat center; | ||
-webkit-mask-size: cover; | ||
mask: url("/_assets/happy-smiley-face.svg") no-repeat center; | ||
mask-size: cover; | ||
background-color: var(--text-primary); | ||
} | ||
} | ||
|
||
.description { | ||
align-self: stretch; | ||
|
||
@media (max-width: 834px) { | ||
max-width: 27.1875rem; | ||
} | ||
|
||
@media (max-width: 425px) { | ||
max-width: 19.4375rem; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { defineField } from "sanity"; | ||
|
||
import { titleID } from "studio/schemas/fields/text"; | ||
export const opennessID = "opennessSection"; | ||
|
||
export const opennessSection = defineField({ | ||
name: opennessID, | ||
title: "Openness", | ||
type: "object", | ||
fields: [ | ||
{ | ||
name: titleID.basic, | ||
title: "Title", | ||
description: | ||
"Enter the primary title that will be displayed at the top of the section.", | ||
type: "internationalizedArrayString", | ||
validation: (rule) => rule.required(), | ||
}, | ||
{ | ||
name: "image", | ||
type: "image", | ||
title: "Image", | ||
description: "An image of the openness", | ||
options: { | ||
hotspot: true, | ||
}, | ||
validation: (rule) => rule.required(), | ||
}, | ||
{ | ||
name: "description", | ||
title: "Description", | ||
description: | ||
"Enter the description that will be displayed in the smiley block.", | ||
type: "internationalizedArrayString", | ||
validation: (rule) => rule.required(), | ||
}, | ||
], | ||
preview: { | ||
prepare() { | ||
return { | ||
title: "Openness Section", | ||
}; | ||
}, | ||
}, | ||
}); |