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

Intervention widget description #1014

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions components/main/blocks/BlockContentRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ export const SectionBlockContentRenderer: React.FC<{ blocks: any }> = ({ blocks
<InterventionWidget
key={block._key || block._id}
title={block.title}
description={block.description}
donationLabel={block.donation_label}
default_sum={block.default_sum}
outputConfiguration={block.output_configuration}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
border-radius: 5px;
width: 100%;
margin-bottom: 30px;
max-width: 740px;
}

.wrapper h3 {
margin-top: 50px;
margin-bottom: 55px;
text-align: left;
max-width: 740px;
margin-left: auto;
margin-right: auto;
}

.header {
margin-bottom: 4rem;
}

.grid {
display: grid;
grid-template-rows: max-content max-content;
Expand Down
10 changes: 7 additions & 3 deletions components/main/blocks/InterventionWidget/InterventionWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import styles from "./InterventionWidget.module.scss";
import {
InterventionWidgetOutput,
InterventionWidgetOutputConfiguration,
SanityIntervention,
} from "./InterventionWidgetOutput";
import { LinkType } from "../Links/Links";
import { NavLink } from "../../../shared/components/Navbar/Navbar";
import { PortableText } from "next-sanity";
import { customComponentRenderers } from "../Paragraph/Citation";

export interface InterventionWidgetProps {
default_sum: number;
title: string;
description: any[];
donationLabel?: string;
outputConfiguration?: InterventionWidgetOutputConfiguration;
/* From site settings */
Expand All @@ -21,6 +21,7 @@ export interface InterventionWidgetProps {
export const InterventionWidget: React.FC<InterventionWidgetProps> = ({
default_sum,
title,
description,
donationLabel,
outputConfiguration,
currency,
Expand All @@ -36,6 +37,9 @@ export const InterventionWidget: React.FC<InterventionWidgetProps> = ({
<div className={styles.wrapper}>
<div className={styles.header}>
<h3>{title}</h3>
{description && (
<PortableText value={description} components={customComponentRenderers}></PortableText>
)}
</div>
<div className={styles.grid}>
<div className={styles.input}>
Expand Down
1 change: 0 additions & 1 deletion components/main/blocks/Links/Links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const LinkComponent: React.FC<{
return (
<Link
href={getHref(link, articlesPagePath)}
passHref
target={link._type === "link" && link.newtab ? "_blank" : ""}
onClick={(e) => {
e.currentTarget.blur();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export const WealthCalculatorTeaser: React.FC<{
? `/${[...articlesPagePath, link.slug].join("/")}`
: `/${link.slug}`
}
passHref
>
<EffektButton onClick={() => {}}>{link.title}</EffektButton>
</Link>
Expand Down Expand Up @@ -126,7 +125,6 @@ export const WealthCalculatorTeaser: React.FC<{
? `/${[...articlesPagePath, link.slug].join("/")}`
: `/${link.slug}`
}
passHref
>
<EffektButton onClick={() => {}} fullWidth>
{link.title}
Expand Down
2 changes: 1 addition & 1 deletion components/main/layout/PreviewBlock/PreviewBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const PreviewBlock: React.FC = () => {
<Eye size={"0.8rem"} />
<span>In preview</span>
<span className={styles.divider}>|</span>
<Link href="/api/exit-preview" passHref className={styles.exitLink}>
<Link href="/api/exit-preview" className={styles.exitLink}>
<span>Exit preview</span>
<LogOut size={"0.8rem"} />
</Link>
Expand Down
7 changes: 1 addition & 6 deletions components/main/layout/RelatedArticles/ArticlePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ export const ArticlePreview: React.FC<{
const { articlesPagePath } = useRouterContext();

return (
<Link
key={slug}
href={`/${[...articlesPagePath, slug].join("/")}`}
passHref
style={{ border: "none" }}
>
<Link key={slug} href={`/${[...articlesPagePath, slug].join("/")}`} style={{ border: "none" }}>
<li className={styles.article}>
{header.published && (
<div className={styles.article__meta}>
Expand Down
2 changes: 1 addition & 1 deletion components/main/layout/RelatedArticles/RelatedArticles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const RelatedArticles: React.FC<{
<div className={styles.header}>
<h4>{relatedArticlesLabel}</h4>
<div className={styles.viewall}>
<Link href={`/${articlesPagePath.join("/")}`} passHref>
<Link href={`/${articlesPagePath.join("/")}`}>
<span>{seeAllArticlesLabel}</span>
<div>β†’</div>
</Link>
Expand Down
5 changes: 2 additions & 3 deletions components/profile/details/DataInfo/DataInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Link from "next/link";
import style from "./DataInfo.module.scss";
import { PortableText } from "@portabletext/react";
import { ProfilePageInfoConfiguration } from "../ProfileInfo/ProfileInfo";
import { ProfilePage } from "../../../../pages/dashboard/ProfilePage";

export const DataInfo: React.FC<{ page: ProfilePage }> = ({ page }) => {
Expand All @@ -13,15 +12,15 @@ export const DataInfo: React.FC<{ page: ProfilePage }> = ({ page }) => {
<strong>{page.tax_subtitle}</strong>
<PortableText value={page.tax} />

<Link href={page.tax_link ?? "/"} passHref target={"_blank"}>
<Link href={page.tax_link ?? "/"} target={"_blank"}>
{page.read_more_label}β†’
</Link>
</section>
<section className={style.privacy}>
<strong>{page.data_subtitle}</strong>
<PortableText value={page.data} />

<Link href={page.data_link ?? "/"} passHref target={"_blank"}>
<Link href={page.data_link ?? "/"} target={"_blank"}>
{page.read_more_label}β†’
</Link>
</section>
Expand Down
2 changes: 0 additions & 2 deletions components/profile/donations/YearMenu/YearMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const DonationYearMenu: React.FC<{
<CustomLink
href={dashboardPath.join("/")}
scroll={false}
passHref
onClick={(e) => e.currentTarget.blur()}
>
<span>{totalTitle}</span>
Expand All @@ -47,7 +46,6 @@ const DonationYearMenu: React.FC<{
pathname: [...donationsPagePath!, year].join("/"),
}}
scroll={false}
passHref
onClick={(e) => e.currentTarget.blur()}
>
<span>{year}</span>
Expand Down
6 changes: 1 addition & 5 deletions components/profile/tax/TaxMenu/TaxMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ const TaxMenu: React.FC<{

return (
<li className={isSelected ? style["menu-selected"] : ""} key={c.slug.current}>
<CustomLink
href={`${taxPagePath.join("/")}/${c.slug.current}`}
passHref
scroll={false}
>
<CustomLink href={`${taxPagePath.join("/")}/${c.slug.current}`} scroll={false}>
{c.title}
</CustomLink>
</li>
Expand Down
1 change: 0 additions & 1 deletion components/shared/components/EffektButton/LinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const LinkButton: React.FC<{
<Link
href={url}
target={target}
passHref
className={`${styles.button} ${
type == "primary"
? styles.buttonprimary
Expand Down
6 changes: 1 addition & 5 deletions components/shared/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export const Navbar = withStaticProps(
<div className={styles.logoWrapperImage}>
<CustomLink
href="/"
passHref
onClick={(e) => e.currentTarget.blur()}
style={{
position: "relative",
Expand All @@ -212,7 +211,6 @@ export const Navbar = withStaticProps(
<div className={styles.logoWrapperImage}>
<CustomLink
href="/"
passHref
onClick={(e) => e.currentTarget.blur()}
style={{
position: "relative",
Expand Down Expand Up @@ -262,7 +260,6 @@ export const Navbar = withStaticProps(
<li key={subel.title} data-cy={`${subel.slug}-link`.replace(/ /g, "-")}>
<CustomLink
href={[...(dashboard ? dashboardPath : []), subel.slug].join("/")}
passHref
onClick={(e) => {
e.currentTarget.blur();
setExpanded(false);
Expand All @@ -280,7 +277,6 @@ export const Navbar = withStaticProps(
<li key={el._key} data-cy={`${el.slug}-link`}>
<CustomLink
href={[...(dashboard ? dashboardPath : []), el.slug].join("/")}
passHref
onClick={() => setExpanded(false)}
>
{el.title}
Expand All @@ -300,7 +296,7 @@ export const Navbar = withStaticProps(
{labels.logout}
</EffektButton>
) : (
<CustomLink href={dashboardPath.join("/")} passHref tabIndex={-1}>
<CustomLink href={dashboardPath.join("/")} tabIndex={-1}>
<EffektButton
variant={EffektButtonVariant.SECONDARY}
onClick={() => setExpanded(false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const CustomCheckBox: React.FC<CheckBoxProps> = ({
<CheckBoxLabel>
{`${label} `}
{hyperlink && (
<Link href={hyperlink.url} passHref target="_blank">
<Link href={hyperlink.url} target="_blank">
{`${hyperlink.text} β†—`}
</Link>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ export const DonorPane: React.FC<{
{text.privacy_policy_text}{" "}
<Link
href={`/${text.privacy_policy_link.slug}`}
passHref
target={"_blank"}
onClick={(e) => {
e.currentTarget.blur();
Expand Down
1 change: 0 additions & 1 deletion components/shared/layout/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ const Footer = withStaticProps(async ({ draftMode = false }: { draftMode: boolea
? `/${footerItem.slug}`
: footerItem.url || "/"
}
passHref
target={footerItem._type === "link" && footerItem.newtab ? "_blank" : ""}
>
{footerItem.title}
Expand Down
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const STUDIO_REWRITE = {
source: "/studio/:path*",
destination:
process.env.NODE_ENV === "development"
? "http://localhost:3333/studio/:path*"
? "http://127.0.0.1:3333/studio/:path*"
: "/studio/index.html",
};

Expand Down
7 changes: 7 additions & 0 deletions studio/schemas/types/interventionwidget.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Zap } from "react-feather";
import { blocktype } from "./blockcontent";

export default {
name: "interventionwidget",
Expand All @@ -11,6 +12,12 @@ export default {
type: "string",
title: "Title",
},
{
name: "description",
title: "Description",
type: "array",
of: [blocktype, { type: "latex" }],
},
{
name: "donation_label",
type: "string",
Expand Down
Loading