Skip to content

Commit

Permalink
[Fix] Dialog fixed position breaking the view (#1186)
Browse files Browse the repository at this point in the history
* [FIx] Dialog fixed position breaking the view

* feat(dialog): add compatibility warning styling and className prop

---------

Co-authored-by: Flavio F Lima <[email protected]>
Co-authored-by: Brett <[email protected]>
  • Loading branch information
3 people authored Dec 11, 2024
1 parent 4040583 commit bd21aea
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/frontend/components/UI/Dialog/index.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
.Dialog__element {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1000;
display: flex;
flex-direction: column;
Expand All @@ -22,6 +19,12 @@
--dialog-gap: 24px;
}

.compatibility-warning {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.Dialog__element[open] {
opacity: 1;
box-shadow: 0px 0px 0px 100vmax var(--modal-backdrop);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface MessageBoxModalProps {
checkboxLabel?: string
checkboxValue?: boolean
isModal?: boolean
className?: string
}

const MessageBoxModal: React.FC<MessageBoxModalProps> = function (props) {
Expand Down Expand Up @@ -71,7 +72,10 @@ const MessageBoxModal: React.FC<MessageBoxModalProps> = function (props) {
<Dialog
onClose={props.onClose}
showCloseButton
className={classNames({ errorDialog: props.type === 'ERROR' })}
className={classNames(
{ errorDialog: props.type === 'ERROR' },
props.className
)}
isModal={props.isModal}
>
<DialogHeader onClose={props.onClose}>{props.title}</DialogHeader>
Expand Down
1 change: 1 addition & 0 deletions src/frontend/components/UI/DialogHandler/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default function DialogHandler() {
buttons={dialogModalOptions.buttons ? dialogModalOptions.buttons : []}
isModal={dialogModalOptions.isModal}
onClose={() => handleClose()}
className={dialogModalOptions.className}
/>
)}
</>
Expand Down
1 change: 1 addition & 0 deletions src/frontend/helpers/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ const launch = async ({
'This Windows game will run using a compatibility layer. You might encounter some issues or the game might not work at all.'
),
title: t('infobox.warning', 'Warning'),
className: 'compatibility-warning',
buttons: [
{
text: t('gamepage:box.dont-show-again', "Don't show again"),
Expand Down
1 change: 1 addition & 0 deletions src/frontend/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export type DialogModalOptions = {
type?: DialogType
onClose?: () => void
isModal?: boolean
className?: string
}

export interface ExternalLinkDialogOptions {
Expand Down

0 comments on commit bd21aea

Please sign in to comment.