Skip to content

Commit 9fb4f32

Browse files
feat(app): change some styles related to Modal and Button (#472)
* fix(app): change styles for Button when it is disabled * fix(app): standardize border-radius of BaseModal * fix(app): standardize border-color in QuestonEditor with rest of app * fix(app): remove min-width from Button styles * refactor(app): use Button component instead of native html tag in MobileActionsButton * refactor(app): tidy MobileActionButton * feat(app): add 'mobileAction' Button variant * fix(app): fix border-radius of modal on mobile * Revert missing styles to Button component * Remove unused imports from Button componenet * Fix Button stories for mobileAction variant Co-authored-by: Michał Miszczyszyn <[email protected]>
1 parent cf2cac9 commit 9fb4f32

File tree

6 files changed

+39
-23
lines changed

6 files changed

+39
-23
lines changed

apps/app/src/components/BaseModal/BaseModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const BaseModal = ({ isOpen, onClose, children }: BaseModalProps) => {
4444
>
4545
<div className="m-auto flex min-h-full w-fit sm:items-center">
4646
<div
47-
className="relative w-full max-w-3xl animate-show rounded-sm bg-white px-3.5 py-9 dark:bg-white-dark sm:px-11 sm:py-20"
47+
className="relative w-full max-w-3xl animate-show rounded-none bg-white px-3.5 py-9 dark:bg-white-dark sm:rounded-md sm:px-11 sm:py-20"
4848
onClick={(event) => {
4949
// stop propagation to avoid triggering `onClick` on the backdrop behind the modal
5050
event.stopPropagation();

apps/app/src/components/Button/Button.stories.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,10 @@ export const Alternative: Story = {
3636
variant: "alternative",
3737
},
3838
};
39+
40+
export const MobileAction: Story = {
41+
args: {
42+
variant: "mobileAction",
43+
children: "+",
44+
},
45+
};
Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
import { ButtonHTMLAttributes } from "react";
22
import { twMerge } from "tailwind-merge";
33

4+
const defaultStyles =
5+
"min-w-[160px] appearance-none rounded-md border border-transparent px-8 py-1 text-sm leading-8 transition-colors duration-100 disabled:cursor-not-allowed sm:py-0";
6+
47
const variants = {
5-
alert: "text-white font-bold bg-red-branding hover:bg-red-branding-dark disabled:bg-[#bfbfbf]",
6-
branding:
7-
"text-violet-700 dark:text-neutral-200 border-violet-700 dark:border-neutral-200 bg-transparent hover:bg-violet-50 hover:dark:bg-violet-900 focus:shadow-[0_0_10px] focus:shadow-primary",
8-
brandingInverse:
9-
"border-white bg-primary text-white hover:text-violet-700 dark:hover:text-white transition-opacity hover:bg-violet-200 focus:shadow-[0_0_10px] focus:shadow-white disabled:opacity-50 hover:dark:bg-violet-700",
10-
alternative:
11-
"text-white-dark border-white-dark bg-yellow-branding hover:bg-yellow-branding-dark focus:shadow-[0_0_10px] focus:shadow-yellow-branding",
8+
alert: twMerge(
9+
defaultStyles,
10+
"text-white font-bold bg-red-branding enabled:hover:bg-red-branding-dark disabled:bg-[#bfbfbf]",
11+
),
12+
branding: twMerge(
13+
defaultStyles,
14+
"text-violet-700 dark:text-neutral-200 border-violet-700 dark:border-neutral-200 bg-transparent enabled:hover:bg-violet-50 enabled:hover:dark:bg-violet-900 focus:shadow-[0_0_10px] focus:shadow-primary",
15+
),
16+
brandingInverse: twMerge(
17+
defaultStyles,
18+
"border-white bg-primary text-white enabled:hover:text-violet-700 enabled:dark:hover:text-white transition-opacity enabled:hover:bg-violet-200 focus:shadow-[0_0_10px] focus:shadow-white disabled:opacity-50 enabled:hover:dark:bg-violet-700",
19+
),
20+
alternative: twMerge(
21+
defaultStyles,
22+
"text-white-dark border-white-dark bg-yellow-branding enabled:hover:bg-yellow-branding-dark focus:shadow-[0_0_10px] focus:shadow-yellow-branding",
23+
),
24+
mobileAction: twMerge(
25+
"flex h-11 w-11 items-center justify-center rounded-full border-none p-0 shadow-md shadow-neutral-600 dark:shadow-neutral-900 bg-primary hover:bg-violet-800 dark:hover:bg-violet-700 text-white",
26+
),
1227
};
1328

1429
type ButtonProps = Readonly<{
@@ -17,12 +32,5 @@ type ButtonProps = Readonly<{
1732
ButtonHTMLAttributes<HTMLButtonElement>;
1833

1934
export const Button = ({ variant, className, ...props }: ButtonProps) => (
20-
<button
21-
className={twMerge(
22-
"min-w-[160px] appearance-none rounded-md border border-transparent px-8 py-1 text-sm leading-8 transition-colors duration-100 disabled:cursor-not-allowed sm:py-0",
23-
variants[variant],
24-
className,
25-
)}
26-
{...props}
27-
/>
35+
<button className={twMerge(variants[variant], className)} {...props} />
2836
);
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ReactNode } from "react";
2+
import { Button } from "../Button/Button";
23

34
type MobileActionButtonProps = Readonly<{
45
children: ReactNode;
@@ -7,8 +8,5 @@ type MobileActionButtonProps = Readonly<{
78
}>;
89

910
export const MobileActionButton = (props: MobileActionButtonProps) => (
10-
<button
11-
className="flex h-11 w-11 appearance-none items-center justify-center rounded-full bg-primary shadow-md shadow-neutral-600 dark:shadow-neutral-900"
12-
{...props}
13-
/>
11+
<Button variant="mobileAction" {...props} />
1412
);

apps/app/src/components/WysiwygEditor/ActionsGroup.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ type ActionsGroupProps = Readonly<{
99
export const ActionsGroup = ({ separator = true, children }: ActionsGroupProps) => {
1010
return (
1111
<div
12-
className={twMerge("flex gap-x-1 pr-1.5", separator && "border-l border-neutral-300 pl-1.5")}
12+
className={twMerge(
13+
"flex gap-x-1 pr-1.5",
14+
separator && "border-l border-primary pl-1.5 dark:border-neutral-300",
15+
)}
1316
>
1417
{children}
1518
</div>

apps/app/src/components/WysiwygEditor/WysiwygEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ export const WysiwygEditor = memo(({ value, onChange }: WysiwygEditorProps) => {
103103
}, [value, isPreview]);
104104

105105
return (
106-
<div className="mt-4 rounded-md border">
107-
<div className="flex border-b p-2.5">
106+
<div className="mt-4 rounded-md border border-primary dark:border-neutral-300">
107+
<div className="flex border-b border-primary p-2.5 dark:border-neutral-300">
108108
{hierarchy.map((actions, i) => (
109109
<ActionsGroup key={i} separator={i !== 0}>
110110
{actions.map((action) => (

0 commit comments

Comments
 (0)