-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from adamviktora/delete-modal-tbd
feat(DeleteModal): first version
- Loading branch information
Showing
22 changed files
with
245 additions
and
417 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 |
---|---|---|
|
@@ -9,6 +9,7 @@ coverage | |
.cache | ||
.tmp | ||
.eslintcache | ||
generated | ||
|
||
# package managers | ||
yarn-error.log | ||
|
4 changes: 2 additions & 2 deletions
4
packages/module/patternfly-docs/content/design-guidelines/design-guidelines.md
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
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
packages/module/patternfly-docs/content/examples/DeleteModal.md
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,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" | ||
|
||
``` |
67 changes: 67 additions & 0 deletions
67
packages/module/patternfly-docs/content/examples/DeleteModalBasic.tsx
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,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> | ||
)} | ||
</> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
packages/module/patternfly-docs/generated/design-guidelines.js
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
...s/module/patternfly-docs/generated/extensions/ai-infra-ui-components/design-guidelines.js
This file was deleted.
Oops, something went wrong.
64 changes: 0 additions & 64 deletions
64
packages/module/patternfly-docs/generated/extensions/ai-infra-ui-components/react.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.