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

chore: tune delete button and dialog #323

Merged
merged 2 commits into from
Sep 19, 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
12 changes: 10 additions & 2 deletions src/features/ModelView/DeleteButton/DeleteModel.styled.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import styled from 'styled-components';
import { spacings } from '../../../tokens/spacings';
import { Dialog } from '@equinor/eds-core-react';

export const Wrapper = styled.div`
display: flex;
flex-direction: column;
row-gap: ${spacings.MEDIUM};
align-items: flex-start;
`;

export const DeleteDialog = styled(Dialog)`
min-width: 336px;
> button {
width: fit-content;
.actions {
display: flex;
flex-flow: row nowrap;
column-gap: ${spacings.SMALL};
}
`;
25 changes: 16 additions & 9 deletions src/features/ModelView/DeleteButton/DeleteModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,31 @@ export const DeleteModel = () => {
<Typography variant="body_long">
This will delete the model along with all related cases and results.
</Typography>
<Button onClick={() => setOpen(!open)} color="danger">
Delete
<Button variant="outlined" onClick={() => setOpen(!open)} color="danger">
Delete
</Button>

<Dialog open={open}>
<Dialog.Header>DELETE</Dialog.Header>
<Styled.DeleteDialog open={open}>
<Dialog.Header>Delete model</Dialog.Header>
<Dialog.Content>
<Typography>Are you sure you want to delete the model?</Typography>
<Typography>
Are you sure you want to delete this model? This action cannot be
undone.
</Typography>
</Dialog.Content>
<Dialog.Actions>
<Button variant="outlined" onClick={() => setOpen(!open)}>
<Dialog.Actions className="actions">
<Button
variant="outlined"
color="danger"
onClick={() => setOpen(!open)}
>
Cancel
</Button>
<Button color="danger" onClick={HandleModelDelete}>
Delete
Delete forever
</Button>
</Dialog.Actions>
</Dialog>
</Styled.DeleteDialog>
</Styled.Wrapper>
);
};