Skip to content

Commit

Permalink
Merge pull request #3 from adamviktora/delete-modal-tbd
Browse files Browse the repository at this point in the history
feat(DeleteModal): first version
  • Loading branch information
nicolethoen authored Oct 9, 2024
2 parents a6ecae0 + b0dd0b1 commit efe28cb
Show file tree
Hide file tree
Showing 22 changed files with 245 additions and 417 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ coverage
.cache
.tmp
.eslintcache
generated

# package managers
yarn-error.log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
# Sidenav top-level section
# should be the same for all markdown files for each extension
section: extensions
section: AI-infra-ui-components
# Sidenav secondary level section
# should be the same for all markdown files for each extension
id: AI-infra-ui-components
id: DeleteModal
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
source: design-guidelines
---
Expand Down
4 changes: 0 additions & 4 deletions packages/module/patternfly-docs/content/examples/Basic.tsx

This file was deleted.

23 changes: 23 additions & 0 deletions packages/module/patternfly-docs/content/examples/DeleteModal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
# Sidenav top-level section
# should be the same for all markdown files
section: AI-infra-ui-components
# Sidenav secondary level section
# should be the same for all markdown files
id: DeleteModal
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
source: react
# If you use typescript, the name of the interface to display props for
# These are found through the sourceProps function provided in patternfly-docs.source.js
propComponents: ['DeleteModal']
---

import { DeleteModal } from "@patternfly/ai-infra-ui-components";

Note: this component documents the API and enhances the [existing DeleteModal](https://github.com/opendatahub-io/odh-dashboard/blob/main/frontend/src/pages/projects/components/DeleteModal.tsx) component from odh-dashboard. It can be imported from [@patternfly/ai-infra-ui-components](https://www.npmjs.com/package/@patternfly/AI-infra-ui-components). Alternatively, it can be used within the odh-dashboard via the import: `~/pages/projects/components/DeleteModal`

### Example

```js file="./DeleteModalBasic.tsx"

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React from 'react';
import { Button, Stack, StackItem } from '@patternfly/react-core';
import { DeleteModal } from '@patternfly/ai-infra-ui-components';

export const DeleteModalBasic: React.FunctionComponent = () => {
const [isModalRecoverableOpen, setIsModalRecoverableOpen] = React.useState(false);
const [isModalDestructiveOpen, setIsModalDestructiveOpen] = React.useState(false);
const [isModalExtraDestructiveOpen, setIsModalExtraDestructiveOpen] = React.useState(false);

return (
<>
<Stack hasGutter style={{ marginBottom: '2rem' }}>
<StackItem>
<Button variant="primary" onClick={() => setIsModalRecoverableOpen(true)}>
Show delete modal (Easily recoverable)
</Button>
</StackItem>
<StackItem>
<Button variant="primary" onClick={() => setIsModalDestructiveOpen(true)}>
Show delete modal (Destructive)
</Button>
</StackItem>
<StackItem>
<Button variant="primary" onClick={() => setIsModalExtraDestructiveOpen(true)}>
Show delete modal (Extra destructive)
</Button>
</StackItem>
</Stack>

{isModalRecoverableOpen && (
<DeleteModal
title="Delete [item]?"
deleteName="item-name"
onDelete={() => {}}
deleteVariant="easily-recoverable"
onClose={() => setIsModalRecoverableOpen(false)}
>
The <strong>item-name</strong> item will be deleted.
</DeleteModal>
)}

{isModalDestructiveOpen && (
<DeleteModal
title="Delete [item]?"
deleteName="item-name"
onDelete={() => {}}
deleteVariant="destructive"
onClose={() => setIsModalDestructiveOpen(false)}
>
The <strong>item-name</strong> item will be deleted. [Brief sentence describing consequence of action].
</DeleteModal>
)}

{isModalExtraDestructiveOpen && (
<DeleteModal
title="Delete [item]?"
deleteName="item-name"
onDelete={() => {}}
deleteVariant="extra-destructive"
onClose={() => setIsModalExtraDestructiveOpen(false)}
>
The <strong>item-name</strong> item will be deleted. [Brief sentence describing consequence of action].
</DeleteModal>
)}
</>
);
};
29 changes: 0 additions & 29 deletions packages/module/patternfly-docs/content/examples/basic.md

This file was deleted.

51 changes: 0 additions & 51 deletions packages/module/patternfly-docs/generated/design-guidelines.js

This file was deleted.

This file was deleted.

This file was deleted.

24 changes: 0 additions & 24 deletions packages/module/patternfly-docs/generated/index.js

This file was deleted.

Loading

0 comments on commit efe28cb

Please sign in to comment.