Update rule card
This commit is contained in:
@@ -39,13 +39,19 @@ export function RuleCardView({
|
|||||||
className?.includes("pb-[");
|
className?.includes("pb-[");
|
||||||
const hasResponsiveGap = className?.includes("gap-[");
|
const hasResponsiveGap = className?.includes("gap-[");
|
||||||
|
|
||||||
const cardPadding = hasResponsivePadding
|
// Expanded + size: uniform padding on all sides (overrides conflicting utilities from `className`).
|
||||||
? "" // If className has responsive padding, don't add size-based padding
|
const cardPadding =
|
||||||
: isLarge || isSmall
|
expanded && isLarge
|
||||||
? "p-[24px]"
|
? "!p-[24px]"
|
||||||
: isMedium
|
: expanded && isMedium
|
||||||
? "p-[16px]"
|
? "!p-[16px]"
|
||||||
: "pb-[24px] pt-[12px] px-[12px]"; // XS: asymmetric padding
|
: hasResponsivePadding
|
||||||
|
? ""
|
||||||
|
: isLarge || isSmall
|
||||||
|
? "p-[24px]"
|
||||||
|
: isMedium
|
||||||
|
? "p-[16px]"
|
||||||
|
: "pb-[24px] pt-[12px] px-[12px]"; // XS: asymmetric padding
|
||||||
const cardGap = expanded
|
const cardGap = expanded
|
||||||
? "gap-[16px]"
|
? "gap-[16px]"
|
||||||
: hasResponsiveGap
|
: hasResponsiveGap
|
||||||
@@ -245,7 +251,11 @@ export function RuleCardView({
|
|||||||
<>
|
<>
|
||||||
{/* Categories Section - Using MultiSelect */}
|
{/* Categories Section - Using MultiSelect */}
|
||||||
{categories && categories.length > 0 && (
|
{categories && categories.length > 0 && (
|
||||||
<div className="flex flex-col gap-[16px] items-start px-[12px] relative shrink-0 w-full">
|
<div
|
||||||
|
className={`flex flex-col gap-[16px] items-start relative shrink-0 w-full ${
|
||||||
|
expanded && (isLarge || isMedium) ? "px-0" : "px-[12px]"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
{categories.map((category, categoryIndex) => (
|
{categories.map((category, categoryIndex) => (
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
key={categoryIndex}
|
key={categoryIndex}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import RuleCard from "../RuleCard";
|
import RuleCard from "../RuleCard";
|
||||||
|
import type { RuleCardProps } from "../RuleCard/RuleCard.types";
|
||||||
import { getAssetPath } from "../../../../lib/assetUtils";
|
import { getAssetPath } from "../../../../lib/assetUtils";
|
||||||
import type { RuleTemplateDto } from "../../../../lib/create/fetchTemplates";
|
import type { RuleTemplateDto } from "../../../../lib/create/fetchTemplates";
|
||||||
import {
|
import {
|
||||||
@@ -22,6 +23,8 @@ export interface TemplateReviewCardProps {
|
|||||||
template: RuleTemplateDto;
|
template: RuleTemplateDto;
|
||||||
/** Merged onto RuleCard `className` (e.g. final-review desktop vs mobile radius/padding). */
|
/** Merged onto RuleCard `className` (e.g. final-review desktop vs mobile radius/padding). */
|
||||||
ruleCardClassName?: string;
|
ruleCardClassName?: string;
|
||||||
|
/** RuleCard size; create-flow passes `L` at/above `md`, `M` below (640px). */
|
||||||
|
size?: RuleCardProps["size"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,6 +34,7 @@ export interface TemplateReviewCardProps {
|
|||||||
export function TemplateReviewCard({
|
export function TemplateReviewCard({
|
||||||
template,
|
template,
|
||||||
ruleCardClassName = "",
|
ruleCardClassName = "",
|
||||||
|
size = "L",
|
||||||
}: TemplateReviewCardProps) {
|
}: TemplateReviewCardProps) {
|
||||||
const catalog = getGovernanceTemplateCatalogEntry(template.slug);
|
const catalog = getGovernanceTemplateCatalogEntry(template.slug);
|
||||||
const pres = catalog ?? FALLBACK_PRESENTATION;
|
const pres = catalog ?? FALLBACK_PRESENTATION;
|
||||||
@@ -42,7 +46,7 @@ export function TemplateReviewCard({
|
|||||||
title={template.title}
|
title={template.title}
|
||||||
description={summary}
|
description={summary}
|
||||||
expanded
|
expanded
|
||||||
size="L"
|
size={size}
|
||||||
categories={categories}
|
categories={categories}
|
||||||
backgroundColor={pres.backgroundColor}
|
backgroundColor={pres.backgroundColor}
|
||||||
className={ruleCardClassName}
|
className={ruleCardClassName}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import type { ReactNode } from "react";
|
|||||||
import { CreateFlowHeaderLockup } from "./CreateFlowHeaderLockup";
|
import { CreateFlowHeaderLockup } from "./CreateFlowHeaderLockup";
|
||||||
import { CreateFlowStepShell } from "./CreateFlowStepShell";
|
import { CreateFlowStepShell } from "./CreateFlowStepShell";
|
||||||
|
|
||||||
/** Shared `RuleCard` / template card chrome: matches final-review desktop + mobile padding and radius. */
|
/** Shared `RuleCard` / template card chrome: width + radius; padding comes from `RuleCard` (L+expanded = 24px). */
|
||||||
export const CREATE_FLOW_REVIEW_RULE_CARD_LAYOUT_CLASS =
|
export const CREATE_FLOW_REVIEW_RULE_CARD_LAYOUT_CLASS =
|
||||||
"w-full min-w-0 rounded-[12px] p-4 md:rounded-[24px] md:!max-w-full md:!w-full md:p-0";
|
"w-full min-w-0 rounded-[12px] md:rounded-[24px] md:!max-w-full md:!w-full";
|
||||||
|
|
||||||
type CreateFlowLockupCardStepShellProps = {
|
type CreateFlowLockupCardStepShellProps = {
|
||||||
lockupTitle: string;
|
lockupTitle: string;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import RuleCard from "../../components/cards/RuleCard";
|
|||||||
import type { Category } from "../../components/cards/RuleCard/RuleCard.types";
|
import type { Category } from "../../components/cards/RuleCard/RuleCard.types";
|
||||||
import { useMessages, useTranslation } from "../../contexts/MessagesContext";
|
import { useMessages, useTranslation } from "../../contexts/MessagesContext";
|
||||||
import { useCreateFlow } from "../context/CreateFlowContext";
|
import { useCreateFlow } from "../context/CreateFlowContext";
|
||||||
|
import { useCreateFlowMdUp } from "../hooks/useCreateFlowMdUp";
|
||||||
import {
|
import {
|
||||||
CREATE_FLOW_REVIEW_RULE_CARD_LAYOUT_CLASS,
|
CREATE_FLOW_REVIEW_RULE_CARD_LAYOUT_CLASS,
|
||||||
CreateFlowLockupCardStepShell,
|
CreateFlowLockupCardStepShell,
|
||||||
@@ -29,6 +30,7 @@ function buildFinalReviewCategories(
|
|||||||
*/
|
*/
|
||||||
export default function FinalReviewPage() {
|
export default function FinalReviewPage() {
|
||||||
const { state } = useCreateFlow();
|
const { state } = useCreateFlow();
|
||||||
|
const mdUp = useCreateFlowMdUp();
|
||||||
const t = useTranslation("create.finalReview");
|
const t = useTranslation("create.finalReview");
|
||||||
const m = useMessages();
|
const m = useMessages();
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ export default function FinalReviewPage() {
|
|||||||
<RuleCard
|
<RuleCard
|
||||||
title={ruleCardTitle}
|
title={ruleCardTitle}
|
||||||
description={ruleCardDescription}
|
description={ruleCardDescription}
|
||||||
size="L"
|
size={mdUp ? "L" : "M"}
|
||||||
expanded={true}
|
expanded={true}
|
||||||
backgroundColor="bg-[#c9fef9]"
|
backgroundColor="bg-[#c9fef9]"
|
||||||
logoUrl="/assets/Vector_MutualAid.svg"
|
logoUrl="/assets/Vector_MutualAid.svg"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
CreateFlowLockupCardStepShell,
|
CreateFlowLockupCardStepShell,
|
||||||
} from "../../components/CreateFlowLockupCardStepShell";
|
} from "../../components/CreateFlowLockupCardStepShell";
|
||||||
import { CreateFlowStepShell } from "../../components/CreateFlowStepShell";
|
import { CreateFlowStepShell } from "../../components/CreateFlowStepShell";
|
||||||
|
import { useCreateFlowMdUp } from "../../hooks/useCreateFlowMdUp";
|
||||||
|
|
||||||
interface PageProps {
|
interface PageProps {
|
||||||
params: Promise<{ slug: string }>;
|
params: Promise<{ slug: string }>;
|
||||||
@@ -26,6 +27,7 @@ interface PageProps {
|
|||||||
export default function ReviewTemplatePage({ params }: PageProps) {
|
export default function ReviewTemplatePage({ params }: PageProps) {
|
||||||
const { slug: rawSlug } = use(params);
|
const { slug: rawSlug } = use(params);
|
||||||
const slug = decodeURIComponent(rawSlug);
|
const slug = decodeURIComponent(rawSlug);
|
||||||
|
const mdUp = useCreateFlowMdUp();
|
||||||
const t = useTranslation("create.templateReview");
|
const t = useTranslation("create.templateReview");
|
||||||
|
|
||||||
const [template, setTemplate] = useState<RuleTemplateDto | null>(null);
|
const [template, setTemplate] = useState<RuleTemplateDto | null>(null);
|
||||||
@@ -94,6 +96,7 @@ export default function ReviewTemplatePage({ params }: PageProps) {
|
|||||||
<TemplateReviewCard
|
<TemplateReviewCard
|
||||||
template={template}
|
template={template}
|
||||||
ruleCardClassName={CREATE_FLOW_REVIEW_RULE_CARD_LAYOUT_CLASS}
|
ruleCardClassName={CREATE_FLOW_REVIEW_RULE_CARD_LAYOUT_CLASS}
|
||||||
|
size={mdUp ? "L" : "M"}
|
||||||
/>
|
/>
|
||||||
</CreateFlowLockupCardStepShell>
|
</CreateFlowLockupCardStepShell>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
import RuleCard from "../../components/cards/RuleCard";
|
import RuleCard from "../../components/cards/RuleCard";
|
||||||
import { useTranslation } from "../../contexts/MessagesContext";
|
import { useTranslation } from "../../contexts/MessagesContext";
|
||||||
import { CreateFlowHeaderLockup } from "../components/CreateFlowHeaderLockup";
|
import { CreateFlowHeaderLockup } from "../components/CreateFlowHeaderLockup";
|
||||||
|
import { useCreateFlowMdUp } from "../hooks/useCreateFlowMdUp";
|
||||||
import { CreateFlowStepShell } from "../components/CreateFlowStepShell";
|
import { CreateFlowStepShell } from "../components/CreateFlowStepShell";
|
||||||
|
|
||||||
/** Mid-flow review step (after upload, before cards). */
|
/** Mid-flow review step (after upload, before cards). */
|
||||||
export default function ReviewPage() {
|
export default function ReviewPage() {
|
||||||
|
const mdUp = useCreateFlowMdUp();
|
||||||
const t = useTranslation("create.review");
|
const t = useTranslation("create.review");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -26,7 +28,7 @@ export default function ReviewPage() {
|
|||||||
<RuleCard
|
<RuleCard
|
||||||
title={t("ruleCard.title")}
|
title={t("ruleCard.title")}
|
||||||
description={t("ruleCard.description")}
|
description={t("ruleCard.description")}
|
||||||
size="L"
|
size={mdUp ? "L" : "M"}
|
||||||
expanded={false}
|
expanded={false}
|
||||||
backgroundColor="bg-[#c9fef9]"
|
backgroundColor="bg-[#c9fef9]"
|
||||||
logoUrl="/assets/Vector_MutualAid.svg"
|
logoUrl="/assets/Vector_MutualAid.svg"
|
||||||
|
|||||||
Reference in New Issue
Block a user