sn: 침입수, RDII 제목란 조금 넓게 외
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { createContext, useContext, type ReactNode } from "react";
|
||||
|
||||
import { Label } from "@common/components";
|
||||
|
||||
@@ -31,8 +31,11 @@ type StandardFormSectionProps = {
|
||||
children: ReactNode;
|
||||
columns?: StandardFormColumns;
|
||||
className?: string;
|
||||
wideLabels?: boolean;
|
||||
};
|
||||
|
||||
const StandardFormWideLabelsContext = createContext(false);
|
||||
|
||||
type StandardFormFieldProps = {
|
||||
id?: string;
|
||||
label: ReactNode;
|
||||
@@ -50,6 +53,7 @@ function StandardFormSection({
|
||||
children,
|
||||
columns = 3,
|
||||
className = "",
|
||||
wideLabels = false,
|
||||
}: StandardFormSectionProps) {
|
||||
return (
|
||||
<section
|
||||
@@ -58,11 +62,13 @@ function StandardFormSection({
|
||||
<h4 className="border-b border-border bg-container px-4 py-3 text-[1.4rem] font-semibold text-label">
|
||||
{title}
|
||||
</h4>
|
||||
<div
|
||||
className={`grid grid-cols-1 gap-px bg-border ${SECTION_GRID_CLASS[columns]}`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
<StandardFormWideLabelsContext.Provider value={wideLabels}>
|
||||
<div
|
||||
className={`grid grid-cols-1 gap-px bg-border ${SECTION_GRID_CLASS[columns]}`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</StandardFormWideLabelsContext.Provider>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -78,9 +84,11 @@ function StandardFormField({
|
||||
children,
|
||||
className = "",
|
||||
}: StandardFormFieldProps) {
|
||||
const wideLabels = useContext(StandardFormWideLabelsContext);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`grid min-w-0 grid-cols-[9rem_minmax(0,1fr)] bg-background sm:grid-cols-[11.5rem_minmax(0,1fr)] ${FIELD_SPAN_CLASS[columns][span]} ${className}`}
|
||||
className={`grid min-w-0 grid-cols-[9rem_minmax(0,1fr)] bg-background ${wideLabels ? "sm:grid-cols-[18rem_minmax(0,1fr)]" : "sm:grid-cols-[11.5rem_minmax(0,1fr)]"} ${FIELD_SPAN_CLASS[columns][span]} ${className}`}
|
||||
>
|
||||
<Label
|
||||
htmlFor={id}
|
||||
@@ -89,7 +97,7 @@ function StandardFormField({
|
||||
{required ? <span className="mr-1 text-red-600">*</span> : null}
|
||||
{label}
|
||||
</Label>
|
||||
<div className="min-w-0 p-3">
|
||||
<div className="flex min-w-0 flex-col justify-center p-3">
|
||||
{children}
|
||||
{error ? (
|
||||
<p className="mt-1 text-[1.2rem] text-red-600" role="alert">
|
||||
|
||||
Reference in New Issue
Block a user