Skip to content

Commit

Permalink
Merge pull request #435 from nerdalert/view-code-modal
Browse files Browse the repository at this point in the history
Fix view code modal from PF6 breakage
  • Loading branch information
vishnoianil authored Dec 16, 2024
2 parents 486509b + 00d9b9f commit c8ba85e
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/components/YamlCodeModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// src/components/YamlCodeModal.tsx
// src/components/YamlCodeModal/index.tsx
'use client';
import React from 'react';
import { Modal } from '@patternfly/react-core/components';
Expand All @@ -15,24 +15,18 @@ interface YamlCodeModalProps {

export const YamlCodeModal: React.FC<YamlCodeModalProps> = ({ isModalOpen, handleModalToggle, yamlContent }) => {
return (
<Modal
variant={ModalVariant.medium}
title="Current YAML"
isOpen={isModalOpen}
onClose={handleModalToggle}
aria-label="YAML Code Modal"
// TODO: fix the typecheck error
// @ts-expect-error: Property 'actions' does not exist on type 'ModalProps'
actions={[
<Button key="close" variant="primary" onClick={handleModalToggle}>
<Modal variant={ModalVariant.medium} title="Current YAML" isOpen={isModalOpen} onClose={handleModalToggle} aria-label="YAML Code Modal">
<div style={{ padding: '40px' }}>
<CodeBlock>
<CodeBlockCode>{yamlContent}</CodeBlockCode>
</CodeBlock>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', padding: '10px 20px' }}>
<Button variant="primary" onClick={handleModalToggle} style={{ marginRight: '10px' }}>
Close
</Button>,
<CopyToClipboardButton key="copy" text={yamlContent} />
]}
>
<CodeBlock>
<CodeBlockCode>{yamlContent}</CodeBlockCode>
</CodeBlock>
</Button>
<CopyToClipboardButton text={yamlContent} />
</div>
</Modal>
);
};
Expand Down

0 comments on commit c8ba85e

Please sign in to comment.