MCPcopy Create free account
hub / github.com/dailydotdev/apps / FormWrapper

Function FormWrapper

packages/shared/src/components/fields/form/FormWrapper.tsx:38–161  ·  view source on GitHub ↗
({
  children,
  className,
  form,
  copy = {},
  leftButtonProps = {},
  rightButtonProps = {},
  headerActions,
  title,
  isHeaderTitle,
  headerRef,
  inBlock = false,
  inSheet = false,
}: FormWrapperProps)

Source from the content-addressed store, hash-verified

36}
37
38export function FormWrapper({
39 children,
40 className,
41 form,
42 copy = {},
43 leftButtonProps = {},
44 rightButtonProps = {},
45 headerActions,
46 title,
47 isHeaderTitle,
48 headerRef,
49 inBlock = false,
50 inSheet = false,
51}: FormWrapperProps): ReactElement {
52 const { left = 'Cancel', right = 'Submit' } = copy;
53 const titleElement = (
54 <PageHeaderTitle
55 className={classNames(
56 'mx-4',
57 !isHeaderTitle && 'mt-5',
58 className?.title ?? 'typo-body',
59 )}
60 >
61 {title}
62 </PageHeaderTitle>
63 );
64
65 const submitButton = (
66 <Button
67 {...rightButtonProps}
68 variant={ButtonVariant.Primary}
69 form={form}
70 className={classNames(
71 inBlock && '!h-[2.375rem] !rounded-14',
72 rightButtonProps.className,
73 )}
74 >
75 {right}
76 </Button>
77 );
78
79 if (inSheet) {
80 return (
81 <div className={classNames('flex w-full flex-col', className?.container)}>
82 <PageHeader
83 className={classNames(
84 'sticky top-0 z-2 -mx-4 flex min-h-11 flex-row items-center gap-2 !border-0 bg-background-default px-4 py-2',
85 className?.header,
86 )}
87 ref={headerRef}
88 >
89 {title && (
90 <span className="min-w-0 flex-1 truncate font-bold typo-title3">
91 {title}
92 </span>
93 )}
94 {headerActions && (
95 <div className="ml-auto flex items-center gap-2">

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected