-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add rought draft of dialog solution * Simplify CardMedia usages * Modify buttons for dialog * Use contain everywhere; remove "in use" language in dialog title * Use startIcon with dialog buttons * Add tool name to default alt texts * Add image to default logo alt text * Render the main image block conditionally * Extract dialog as ImageDialog component * Add newline at EOF
- Loading branch information
Showing
2 changed files
with
82 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import CloseIcon from '@mui/icons-material/Close'; | ||
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'; | ||
import { styled } from '@mui/material/styles'; | ||
|
||
const DialogImg = styled('img')(() => ({ | ||
width: '100%', | ||
height: 'auto', | ||
objectFit: 'contain' | ||
})); | ||
|
||
interface ImageDialogProps { | ||
titleData: { | ||
title: string | ||
id: string | ||
}, | ||
imageData: { | ||
src: string | ||
altText: string | ||
} | ||
open: boolean | ||
onClose: () => void; | ||
} | ||
|
||
export default function ImageDialog (props: ImageDialogProps) { | ||
const { titleData, imageData, open, onClose } = props; | ||
return ( | ||
<Dialog | ||
fullWidth | ||
maxWidth='xl' | ||
open={open} | ||
onClose={onClose} | ||
aria-labelledby={titleData.id} | ||
> | ||
<DialogTitle id={titleData.id}>{titleData.title}</DialogTitle> | ||
<DialogContent> | ||
<DialogImg tabIndex={0} src={imageData.src} alt={imageData.altText} /> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button aria-label='Close image dialog' startIcon={<CloseIcon />} onClick={onClose}> | ||
Close | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters