Skip to content

Commit

Permalink
refactor(modal): restructure close icon as button
Browse files Browse the repository at this point in the history
  • Loading branch information
tarantilis committed Mar 27, 2023
1 parent 31ca523 commit f1b836e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/ui/Modal/Modal.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Button, Modal } from 'semantic-ui-react';
import { Button, Modal, Icon } from 'semantic-ui-react';

export default {
title: 'Components/Modal',
Expand Down Expand Up @@ -84,7 +84,7 @@ function ModalEEA({
const [open, setOpen] = React.useState(false);
return (
<Modal
closeIcon
//closeIcon
onClose={() => setOpen(false)}
onOpen={() => setOpen(true)}
open={open}
Expand All @@ -93,6 +93,10 @@ function ModalEEA({
size={size}
dimmer={dimmer}
>
<Button className="close icon" onClick={() => setOpen(false)} title='Close modal dialog'>
<Icon name="close" />
</Button>

<Modal.Header>{header}</Modal.Header>
<Modal.Content>
<Modal.Description>{content}</Modal.Description>
Expand Down
13 changes: 13 additions & 0 deletions theme/themes/eea/modules/modal.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@
.ui.modal > :last-child {
overflow: hidden; // clear floats from modal
}

.ui.modal .ui.button.close {
background: @closeButtonBackground;
padding: @closeButtonPadding;

i {
color: @closeColor;
}
}

.ui.modal .ui.button.close:focus-visible {
outline: @focusVisibleOutline;
}
6 changes: 5 additions & 1 deletion theme/themes/eea/modules/modal.variables
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
/* Close Icon */
@closeOpacity: 0.8;
@closeSize: 1.25em;
@closeColor: @black;
@closeColor: @grey-6;

/* Close Button */
@closeButtonBackground: transparent;
@closeButtonPadding: 0;

@closeHitbox: 2.25rem;
@closeDistance: 0.25rem;
Expand Down

0 comments on commit f1b836e

Please sign in to comment.