Skip to content

Commit e6374ba

Browse files
committed
buttonText property baked into the Theme model
1 parent 47c3bf4 commit e6374ba

4 files changed

Lines changed: 63 additions & 47 deletions

File tree

apps/web/components/admin/page-editor/theme-editor/index.tsx

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -552,44 +552,59 @@ function ThemeEditor({
552552
case "colors":
553553
return (
554554
<div className="space-y-2 p-2">
555-
{Object.keys(theme.draftTheme!.colors)
556-
.filter(
557-
(color) =>
558-
![
559-
"success",
560-
"warning",
561-
"error",
562-
"info",
563-
].includes(color),
564-
)
565-
.map((color) => (
566-
<ColorSelector
567-
key={color}
568-
title={capitalize(color)}
569-
value={theme.draftTheme!.colors[color]}
570-
onChange={async (value) => {
571-
const updatedColors = {
572-
...theme.draftTheme!.colors,
573-
[color]: value,
574-
};
575-
setTheme({
576-
...theme,
577-
draftTheme: {
578-
...theme.draftTheme!,
579-
colors: updatedColors,
580-
},
581-
});
582-
await updateThemeCategory(
583-
"colors",
584-
updatedColors as unknown as Record<
585-
string,
586-
string
587-
>,
588-
);
589-
}}
590-
allowReset={false}
591-
/>
592-
))}
555+
{[
556+
{
557+
name: "primary",
558+
displayName: "Primary",
559+
},
560+
{
561+
name: "secondary",
562+
displayName: "Secondary",
563+
},
564+
{
565+
name: "background",
566+
displayName: "Background",
567+
},
568+
{
569+
name: "text",
570+
displayName: "Text",
571+
},
572+
{
573+
name: "border",
574+
displayName: "Border",
575+
},
576+
{
577+
name: "buttonText",
578+
displayName: "Button Text",
579+
},
580+
].map((color) => (
581+
<ColorSelector
582+
key={color.name}
583+
title={color.displayName}
584+
value={theme.draftTheme!.colors[color.name]}
585+
onChange={async (value) => {
586+
const updatedColors = {
587+
...theme.draftTheme!.colors,
588+
[color.name]: value,
589+
};
590+
setTheme({
591+
...theme,
592+
draftTheme: {
593+
...theme.draftTheme!,
594+
colors: updatedColors,
595+
},
596+
});
597+
await updateThemeCategory(
598+
"colors",
599+
updatedColors as unknown as Record<
600+
string,
601+
string
602+
>,
603+
);
604+
}}
605+
allowReset={false}
606+
/>
607+
))}
593608
</div>
594609
);
595610
case "typography":

apps/web/models/Theme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const ThemeSchema = new mongoose.Schema<Theme>({
2323
background: { type: String, required: true },
2424
border: { type: String, required: true },
2525
text: { type: String, required: true },
26+
buttonText: { type: String, required: true },
2627
success: { type: String, required: true },
2728
error: { type: String, required: true },
2829
warning: { type: String, required: true },

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"test:watch": "NODE_OPTIONS='--experimental-vm-modules' SUPPRESS_JEST_WARNINGS=1 jest --watch",
2929
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' SUPPRESS_JEST_WARNINGS=1 jest --coverage"
3030
},
31-
"packageManager": "pnpm@10.8.1",
31+
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977",
3232
"devDependencies": {
3333
"@testing-library/dom": "^10.4.0",
3434
"@testing-library/jest-dom": "^6.6.3",

packages/page-primitives/src/themes/learning.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,40 +95,40 @@ const themeStyles: ThemeStyle = {
9595
},
9696
interactives: {
9797
button: {
98-
padding: { x: "px-6", y: "py-3" },
98+
padding: { x: "px-6", y: "py-4" },
9999
border: {
100100
width: "border-2",
101-
radius: "rounded-lg",
101+
radius: "rounded",
102102
style: "border-solid",
103103
},
104104
shadow: "shadow-lg",
105-
hover: "transition-colors duration-200 ease-in-out hover:bg-blue-700 hover:shadow-xl",
105+
hover: "transition-all duration-200 ease-in-out hover:bg-blue-700 hover:shadow-xl hover:scale-105",
106106
disabled: {
107-
background: "#BFDBFE",
107+
background: "#F3F4F6",
108108
opacity: "opacity-50",
109109
cursor: "cursor-not-allowed",
110110
},
111111
},
112112
link: {
113113
padding: { x: "px-1", y: "py-0" },
114-
hover: "transition-colors duration-150 ease-in-out hover:text-indigo-700 hover:underline",
114+
hover: "transition-all duration-150 ease-in-out hover:text-blue-700 hover:underline hover:scale-105",
115115
},
116116
card: {
117117
padding: { x: "px-8", y: "py-8" },
118118
border: {
119119
width: "border",
120-
radius: "rounded-2xl",
120+
radius: "rounded",
121121
style: "border-solid",
122122
},
123123
shadow: "shadow-xl",
124-
hover: "transition-shadow duration-200 ease-in hover:shadow-2xl",
124+
hover: "transition-all duration-200 ease-in-out hover:shadow-2xl hover:scale-105",
125125
},
126126
input: {
127127
borderRadius: "rounded-lg",
128128
padding: { x: "px-5", y: "py-3" },
129129
border: { width: "border-2", style: "border-solid" },
130130
shadow: "shadow",
131-
hover: "transition-colors duration-150 ease-in-out hover:border-blue-400",
131+
hover: "transition-all duration-150 ease-in-out hover:border-blue-400 hover:shadow-md",
132132
disabled: {
133133
background: "#F3F4F6",
134134
cursor: "cursor-not-allowed",

0 commit comments

Comments
 (0)