Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: APP-2761 - Introduce z-index component customisations for the Dropdown and Dialogs components #124

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Implement animations for `Dialog` and `DialogAlert` components
- Implement `DaoAvatar` and `MemberAvatar` module components
- Implement `OdsModulesProvider` for using wagmi hooks on modules components
- Introduce component customisations for the z-index property of the `Dropdown` and `Dialogs` components

### Changed

Expand Down
2 changes: 1 addition & 1 deletion index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "./src/theme/index.css";
@import "./src";

@tailwind base;
@tailwind components;
Expand Down
7 changes: 6 additions & 1 deletion src/core/components/dialogs/dialog/dialogRoot/dialogRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export const DialogRoot: React.FC<IDialogRootProps> = (props) => {
{rootProps.open && (
<Portal forceMount key="portal">
<Overlay
className={classNames('fixed inset-0 bg-modal-overlay backdrop-blur-md', overlayClassName)}
className={classNames(
'fixed inset-0 bg-modal-overlay backdrop-blur-md',
'z-[var(--ods-dialog-overlay-z-index)]',
overlayClassName,
)}
asChild
>
<motion.div
Expand All @@ -88,6 +92,7 @@ export const DialogRoot: React.FC<IDialogRootProps> = (props) => {
className={classNames(
'fixed inset-x-2 bottom-2 mx-auto max-h-[calc(100vh-80px)] lg:bottom-auto lg:top-[120px] lg:max-h-[calc(100vh-200px)]',
'flex max-w-[480px] flex-col rounded-xl border border-neutral-100 bg-neutral-0 shadow-neutral-md md:min-w-[480px]',
'z-[var(--ods-dialog-content-z-index)]',
containerClassName,
)}
onCloseAutoFocus={onCloseAutoFocus}
Expand Down
7 changes: 7 additions & 0 deletions src/core/components/dialogs/dialog/dialogRoot/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:root {
/* Z-index property of the dialog overlay */
--ods-dialog-overlay-z-index: auto;

/* Z-index property of the dialog content */
--ods-dialog-content-z-index: auto;
}
1 change: 1 addition & 0 deletions src/core/components/dialogs/dialog/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "./dialogRoot";
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export const DialogAlertRoot: React.FC<IDialogAlertRootProps> = (props) => {
{rootProps.open && (
<Portal forceMount key="portal">
<Overlay
className={classNames('fixed inset-0 bg-modal-overlay backdrop-blur-md', overlayClassName)}
className={classNames(
'fixed inset-0 bg-modal-overlay backdrop-blur-md',
'z-[var(--ods-dialog-alert-overlay-z-index)]',
overlayClassName,
)}
asChild
>
<motion.div
Expand All @@ -96,6 +100,7 @@ export const DialogAlertRoot: React.FC<IDialogAlertRootProps> = (props) => {
className={classNames(
'fixed inset-x-2 bottom-2 mx-auto max-h-[calc(100vh-80px)] lg:bottom-auto lg:top-[120px] lg:max-h-[calc(100vh-200px)]',
'flex max-w-[480px] flex-col rounded-xl border border-neutral-100 bg-neutral-0 shadow-neutral-md md:min-w-[480px]',
'z-[var(--ods-dialog-alert-content-z-index)]',
containerClassName,
)}
onCloseAutoFocus={onCloseAutoFocus}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:root {
/* Z-index property of the dialog overlay */
--ods-dialog-alert-overlay-z-index: auto;

/* Z-index property of the dialog content */
--ods-dialog-alert-content-z-index: auto;
}
1 change: 1 addition & 0 deletions src/core/components/dialogs/dialogAlert/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "./dialogAlertRoot";
2 changes: 2 additions & 0 deletions src/core/components/dialogs/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "./dialog";
@import "./dialogAlert";
1 change: 1 addition & 0 deletions src/core/components/dropdown/dropdownContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const DropdownContainer: React.FC<IDropdownContainerProps> = (props) => {
className={classNames(
'flex min-w-48 flex-col gap-1.5 overflow-auto rounded-xl border border-neutral-100 bg-neutral-0 p-2 shadow-neutral-sm',
'max-h-[var(--radix-dropdown-menu-content-available-height)] max-w-[var(--radix-dropdown-menu-content-available-width)]',
'z-[var(--ods-dropdown-container-content-z-index)]',
)}
onCloseAutoFocus={(event) => event.preventDefault()}
align={align}
Expand Down
4 changes: 4 additions & 0 deletions src/core/components/dropdown/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:root {
/* Z-index property of the content insdie the dropdown container */
--ods-dropdown-container-content-z-index: auto;
}
2 changes: 2 additions & 0 deletions src/core/components/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "./dialogs";
@import "./dropdown";
1 change: 1 addition & 0 deletions src/core/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "./components";
2 changes: 2 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "./core";
@import "./theme";
Loading