-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(json-schema-2020-12): add support for deep expandable behavior
Refs #8513
- Loading branch information
Showing
10 changed files
with
122 additions
and
25 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
31 changes: 31 additions & 0 deletions
31
src/core/plugins/json-schema-2020-12/components/ExpandDeepButton/ExpandDeepButton.jsx
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,31 @@ | ||
/** | ||
* @prettier | ||
*/ | ||
import React, { useCallback } from "react" | ||
import PropTypes from "prop-types" | ||
|
||
const ExpandDeepButton = ({ expanded, onClick }) => { | ||
const handleExpansion = useCallback( | ||
(event) => { | ||
onClick(event, !expanded) | ||
}, | ||
[expanded, onClick] | ||
) | ||
|
||
return ( | ||
<button | ||
type="button" | ||
className="json-schema-2020-12-expand-deep-button" | ||
onClick={handleExpansion} | ||
> | ||
{expanded ? "Collapse all" : "Expand all"} | ||
</button> | ||
) | ||
} | ||
|
||
ExpandDeepButton.propTypes = { | ||
expanded: PropTypes.bool.isRequired, | ||
onClick: PropTypes.func.isRequired, | ||
} | ||
|
||
export default ExpandDeepButton |
6 changes: 6 additions & 0 deletions
6
src/core/plugins/json-schema-2020-12/components/ExpandDeepButton/_expand-deep-button.scss
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,6 @@ | ||
.json-schema-2020-12-expand-deep-button { | ||
@include text_headline($section-models-model-title-font-color); | ||
font-size: 12px; | ||
color: #6b6b6b; | ||
border: none; | ||
} |
84 changes: 61 additions & 23 deletions
84
src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx
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 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@import './BooleanJSONSchema/boolean-json-schema'; | ||
@import './JSONSchema/json-schema'; | ||
@import './Accordion/accordion'; | ||
@import './ExpandDeepButton/expand-deep-button'; |
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 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 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 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 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