🎨(react) enhance Modal component styles
update Modal token and css files with new css variables introduce with the new tokens architectures
This commit is contained in:
committed by
NathanVss
parent
dcf1c8b8bb
commit
b04fdd32c7
@@ -16,7 +16,9 @@ export const DeleteConfirmationModal = ({
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={title ?? t("components.modals.helpers.delete_confirmation.title")}
|
title={title ?? t("components.modals.helpers.delete_confirmation.title")}
|
||||||
titleIcon={<span className="material-icons clr-danger-600">delete</span>}
|
titleIcon={
|
||||||
|
<span className="material-icons delete-confirmation-icon">delete</span>
|
||||||
|
}
|
||||||
size={ModalSize.SMALL}
|
size={ModalSize.SMALL}
|
||||||
actions={
|
actions={
|
||||||
<>
|
<>
|
||||||
@@ -30,7 +32,7 @@ export const DeleteConfirmationModal = ({
|
|||||||
<Button
|
<Button
|
||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
onClick={() => onDecide("delete")}
|
onClick={() => onDecide("delete")}
|
||||||
color="danger"
|
variant="error"
|
||||||
>
|
>
|
||||||
{t("components.modals.helpers.delete_confirmation.delete")}
|
{t("components.modals.helpers.delete_confirmation.delete")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Modal, ModalSize } from ":/components/Modal/index";
|
|||||||
import { useCunningham } from ":/components/Provider";
|
import { useCunningham } from ":/components/Provider";
|
||||||
import { Button } from ":/components/Button";
|
import { Button } from ":/components/Button";
|
||||||
import { DecisionModalProps } from ":/components/Modal/ModalProvider";
|
import { DecisionModalProps } from ":/components/Modal/ModalProvider";
|
||||||
import { colorFromType, iconFromType, VariantType } from ":/utils/VariantUtils";
|
import { iconFromType, VariantType } from ":/utils/VariantUtils";
|
||||||
|
|
||||||
export type MessageModalProps = DecisionModalProps & {
|
export type MessageModalProps = DecisionModalProps & {
|
||||||
messageType: VariantType;
|
messageType: VariantType;
|
||||||
@@ -26,7 +26,7 @@ export const MessageModal = ({
|
|||||||
<span
|
<span
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"material-icons",
|
"material-icons",
|
||||||
`clr-${colorFromType(messageType)}-600`,
|
`modal-message-${messageType}-icon`
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{iconFromType(messageType)}
|
{iconFromType(messageType)}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&__title {
|
&__title {
|
||||||
--font-size: var(--c--theme--font--sizes--h2);
|
--font-size: var(--c--globals--font--sizes--h2);
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
font-size: var(--font-size);
|
font-size: var(--font-size);
|
||||||
font-weight: var(--c--components--modal--title-font-weight);
|
font-weight: var(--c--components--modal--title-font-weight);
|
||||||
@@ -68,6 +68,26 @@
|
|||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
--icon-size: 2rem;
|
--icon-size: 2rem;
|
||||||
|
|
||||||
|
.delete-confirmation-icon {
|
||||||
|
color: var(--c--contextuals--content--semantic--netural--tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-message-error-icon {
|
||||||
|
color: var(--c--contextuals--content--semantic--error--tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-message-warning-icon {
|
||||||
|
color: var(--c--contextuals--content--semantic--warning--tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-message-info-icon {
|
||||||
|
color: var(--c--contextuals--content--semantic--info--tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-message-success-icon {
|
||||||
|
color: var(--c--contextuals--content--semantic--success--tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
font-size: var(--icon-size);
|
font-size: var(--icon-size);
|
||||||
}
|
}
|
||||||
@@ -96,10 +116,10 @@
|
|||||||
height: 0;
|
height: 0;
|
||||||
|
|
||||||
.c__button {
|
.c__button {
|
||||||
right: -0.75rem;
|
right: -1.1rem;
|
||||||
top: -0.75rem;
|
top: -1.1rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--c--components--modal--background-color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +145,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__left, &__right {
|
&__left,
|
||||||
|
&__right {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
@@ -151,7 +172,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.c__modal__title-icon {
|
.c__modal__title-icon {
|
||||||
--icon-size: 4rem;
|
--icon-size: 4rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +188,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.c__modal__title-icon {
|
.c__modal__title-icon {
|
||||||
--icon-size: 4rem;
|
--icon-size: 4rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +200,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.c__modal__title {
|
.c__modal__title {
|
||||||
--font-size: var(--c--theme--font--sizes--h1);
|
--font-size: var(--c--globals--font--sizes--h1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.c__modal__title-icon {
|
.c__modal__title-icon {
|
||||||
@@ -204,11 +225,11 @@
|
|||||||
|
|
||||||
.c__modal__content {
|
.c__modal__content {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
overflow-y:scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.c__modal__title {
|
.c__modal__title {
|
||||||
--font-size: var(--c--theme--font--sizes--h1);
|
--font-size: var(--c--globals--font--sizes--h1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.c__modal__title-icon {
|
.c__modal__title-icon {
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ export const ModalInner = ({ closeOnEsc = true, ...props }: ModalProps) => {
|
|||||||
<div className="c__modal__close">
|
<div className="c__modal__close">
|
||||||
<Button
|
<Button
|
||||||
icon={<span className="material-icons">close</span>}
|
icon={<span className="material-icons">close</span>}
|
||||||
color="tertiary-text"
|
color="tertiary"
|
||||||
|
variant="neutral"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={props.onClose}
|
onClick={props.onClose}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -2,17 +2,17 @@ import { DefaultTokens } from "@openfun/cunningham-tokens";
|
|||||||
|
|
||||||
export const tokens = (defaults: DefaultTokens) => {
|
export const tokens = (defaults: DefaultTokens) => {
|
||||||
return {
|
return {
|
||||||
"background-color": defaults.theme.colors["greyscale-000"],
|
"background-color": defaults.contextuals.background.surface.secondary,
|
||||||
"backdrop-color": "#0C1A2B99",
|
"backdrop-color": "#00000099",
|
||||||
"border-radius": "4px",
|
"border-radius": "4px",
|
||||||
"border-color": defaults.theme.colors["greyscale-300"],
|
"border-color": defaults.contextuals.border.surface.primary,
|
||||||
"box-shadow": "0px 1px 2px 0px #0C1A2B4D",
|
"box-shadow": "0px 1px 2px 0px #0C1A2B4D",
|
||||||
color: defaults.theme.colors["greyscale-900"],
|
color: defaults.contextuals.content.semantic.neutral.primary,
|
||||||
// "backdrop-color": "#0C1A2B99", // Does not work yet due to backdrop CSS var support.
|
// "backdrop-color": "#0C1A2B99", // Does not work yet due to backdrop CSS var support.
|
||||||
"title-font-weight": defaults.theme.font.weights.bold,
|
"title-font-weight": defaults.globals.font.weights.bold,
|
||||||
"content-font-size": defaults.theme.font.sizes.m,
|
"content-font-size": defaults.globals.font.sizes.sm,
|
||||||
"content-font-weight": defaults.theme.font.weights.regular,
|
"content-font-weight": defaults.globals.font.weights.regular,
|
||||||
"content-color": defaults.theme.colors["greyscale-800"],
|
"content-color": defaults.contextuals.content.semantic.neutral.primary,
|
||||||
"width-small": "300px",
|
"width-small": "300px",
|
||||||
"width-medium": "600px",
|
"width-medium": "600px",
|
||||||
"width-large": "800px",
|
"width-large": "800px",
|
||||||
|
|||||||
Reference in New Issue
Block a user