-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👻 Move SimpleDocumentViewer to directory (#1945)
Extract existing components to files. No functional changes have been introduced. Part-of: #1929 Signed-off-by: Radoslaw Szwajkowski <[email protected]>
- Loading branch information
Showing
8 changed files
with
292 additions
and
263 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
client/src/app/components/simple-document-viewer/LanguageToggle.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,55 @@ | ||
import * as React from "react"; | ||
import { Language } from "@patternfly/react-code-editor"; | ||
import { ToggleGroup, ToggleGroupItem } from "@patternfly/react-core"; | ||
import { css } from "@patternfly/react-styles"; | ||
import editorStyles from "@patternfly/react-styles/css/components/CodeEditor/code-editor"; | ||
import CodeIcon from "@patternfly/react-icons/dist/esm/icons/code-icon"; | ||
import "./SimpleDocumentViewer.css"; | ||
|
||
export const LanguageToggle: React.FC<{ | ||
currentLanguage: Language.yaml | Language.json; | ||
code?: string; | ||
setCurrentLanguage: (lang: Language.yaml | Language.json) => void; | ||
}> = ({ currentLanguage, code, setCurrentLanguage }) => ( | ||
<div | ||
className={css( | ||
editorStyles.codeEditorTab, | ||
"language-toggle-group-container" | ||
)} | ||
key="code-language-toggle" | ||
> | ||
<ToggleGroup | ||
aria-label="code content type selection" | ||
className="language-toggle-group" | ||
> | ||
<ToggleGroupItem | ||
text={ | ||
<> | ||
<span className={editorStyles.codeEditorTabIcon}> | ||
<CodeIcon /> | ||
</span> | ||
<span className={editorStyles.codeEditorTabText}>JSON</span> | ||
</> | ||
} | ||
buttonId="code-language-select-json" | ||
isSelected={currentLanguage === "json"} | ||
isDisabled={!code && currentLanguage !== "json"} | ||
onChange={() => setCurrentLanguage(Language.json)} | ||
/> | ||
<ToggleGroupItem | ||
text={ | ||
<> | ||
<span className={editorStyles.codeEditorTabIcon}> | ||
<CodeIcon /> | ||
</span> | ||
<span className={editorStyles.codeEditorTabText}>YAML</span> | ||
</> | ||
} | ||
buttonId="code-language-select-yaml" | ||
isSelected={currentLanguage === "yaml"} | ||
isDisabled={!code && currentLanguage !== "yaml"} | ||
onChange={() => setCurrentLanguage(Language.yaml)} | ||
/> | ||
</ToggleGroup> | ||
</div> | ||
); |
17 changes: 17 additions & 0 deletions
17
client/src/app/components/simple-document-viewer/RefreshControl.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,17 @@ | ||
import * as React from "react"; | ||
import { CodeEditorControl } from "@patternfly/react-code-editor"; | ||
import UndoIcon from "@patternfly/react-icons/dist/esm/icons/undo-icon"; | ||
import "./SimpleDocumentViewer.css"; | ||
|
||
export const RefreshControl: React.FC<{ | ||
refetch: () => void; | ||
isVisible: boolean; | ||
}> = ({ refetch, isVisible }) => ( | ||
<CodeEditorControl | ||
icon={<UndoIcon />} | ||
aria-label="refresh-task" | ||
tooltipProps={{ content: "Refresh" }} | ||
onClick={refetch} | ||
isVisible={isVisible} | ||
/> | ||
); |
File renamed without changes.
Oops, something went wrong.