Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | 21x 21x 21x 21x 21x 21x 21x 15x 45x | import { Box, Grid, Stack } from "@mui/material";
import { ColorPickerInput } from "@sections/PayBuilder/components/ColorPickerInput";
import useCheckFormType from "@sections/PayBuilder/components/hooks/useCheckFormType";
import { usePayBuilderForm } from "@sections/PayBuilder/provider/PayBuilderFormProvider";
import { HFGiveInput } from "@shared/HFInputs/HFGiveInput/HFGiveInput";
import GiveText from "@shared/Text/GiveText";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import { styled, useAppTheme } from "@theme/v2/Provider";
import ADBStylerLink from "./ADBStylerLink";
import { Card } from "./components/Card";
import { List } from "./components/List";
import GiveSelect from "@shared/GiveInputs/GiveSelect";
import { InputAdornment } from "@mui/material";
import {
bgColorOptions,
ColorOptionCircle,
} from "./components/StylingBackgroundColorOptions";
import { LogoUploader } from "./components/LogoUploader";
import { PAYBUILDER_WHITE_BACKGROUND } from "@sections/PayBuilder/consts";
export function Styling({
isEdit,
isFromADB,
}: {
isEdit?: boolean;
isFromADB?: boolean;
}) {
const { palette } = useAppTheme();
const { methods } = usePayBuilderForm();
const { setValue, watch } = methods;
const { isMobileView, isTabletView } = useCustomThemeV2();
const { accent, background } = watch().Style;
const { isFundraiser, isInvoice, isProduct } = useCheckFormType();
return (
<Box>
{isEdit && isFromADB && <ADBStylerLink />}
<Stack gap="24px">
<LogoUploader />
<Grid container justifyContent="space-between" gap={1}>
<Stack sx={{ width: "48%" }} gap={1}>
<GiveText>Background</GiveText>
<GiveSelect
options={bgColorOptions}
onChange={(e: any) =>
setValue("Style.background", e.target.value)
}
value={background}
defaultValue={PAYBUILDER_WHITE_BACKGROUND}
useContextualMenu
contextualMenuProps={
{
...(!isMobileView
? {
color: "transparent",
texture: "lightBlur",
height: "578px",
anchorOrigin: {
vertical: "bottom",
horizontal: "left",
},
transformOrigin: {
vertical: "top",
horizontal: "left",
},
}
: { height: "auto" }),
Header: (
<GiveText
variant="bodyS"
color="secondary"
sx={{ padding: "10px 8px 4px 12px" }}
>
Background Colors
</GiveText>
),
} as any
}
InputProps={{
sx: {
padding: "0 !important",
height: "44px",
background: `${palette.primitive?.transparent["darken-5"]} !important`,
border: "none !important",
},
startAdornment: (
<InputAdornment
sx={{ pr: "8px" }}
position="start"
>
<ColorOptionCircle
bgColor={background}
width="24px"
height="24px"
borderColor={palette.border?.tertiary}
/>
</InputAdornment>
),
}}
/>
</Stack>
<Stack sx={{ width: "48%" }} gap={1}>
<GiveText>Accent</GiveText>
<ColorPickerInput
onSave={(val: string) => {
setValue("Style.accent", val);
}}
defaultColor={accent}
/>
</Stack>
</Grid>
{isProduct && (
<Stack gap={1}>
<GiveText>Item Layout</GiveText>
<Grid container alignItems="center" justifyContent="space-between">
<StyledGridItem item>
<List width={isMobileView || isTabletView ? 160 : "100%"} />
<GiveText color="secondary">List</GiveText>
</StyledGridItem>
<StyledGridItem item>
<Card width={isMobileView || isTabletView ? 140 : "100%"} />
<GiveText color="secondary">Card</GiveText>
</StyledGridItem>
</Grid>
</Stack>
)}
{!isFundraiser && !isInvoice && (
<HFGiveInput
name="Style.checkoutContent"
label="Checkout Button Text"
maxLength={50}
handleNormalizeInput={(value: string) => {
return value.replace(/[^a-zA-Z ]/g, "");
}}
onBlur={() => {
const value = methods.getValues("Style.checkoutContent").trim();
if (value === "")
methods.setValue("Style.checkoutContent", "Checkout");
}}
/>
)}
</Stack>
</Box>
);
}
const StyledGridItem = styled(Grid)(() => ({
width: "48%",
display: "flex",
flexDirection: "column",
gap: 1,
}));
|