forked from inspectIT/inspectit-ocelot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes inspectIT#811: Refactored Sections and SelectionInformation
- Loading branch information
Alexander Wert
committed
Jul 15, 2020
1 parent
7f7629f
commit a069cc9
Showing
7 changed files
with
113 additions
and
82 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
35 changes: 35 additions & 0 deletions
35
...nts/inspectit-ocelot-configurationserver-ui/src/components/editor/SelectionInformation.js
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,35 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* Placeholder component for the case that no content is selected. | ||
*/ | ||
const SelectionInformation = ({ hint }) => { | ||
return ( | ||
<div className="p-col"> | ||
<style jsx>{` | ||
.selection-information { | ||
display: flex; | ||
height: 100%; | ||
align-items: center; | ||
justify-content: center; | ||
color: #bbb; | ||
} | ||
`}</style> | ||
<div className="selection-information"> | ||
<div>{hint}</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
SelectionInformation.propTypes = { | ||
/** The hint to show */ | ||
hint: PropTypes.string, | ||
}; | ||
|
||
SelectionInformation.defaultProps = { | ||
hint: 'Select item', | ||
}; | ||
|
||
export default SelectionInformation; |
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
52 changes: 52 additions & 0 deletions
52
components/inspectit-ocelot-configurationserver-ui/src/components/views/alerting/Section.js
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,52 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
const Section = ({ title, children, scrollable }) => { | ||
return ( | ||
<div className={classNames("this", { 'scrollable': scrollable })}> | ||
<style jsx>{` | ||
.this { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
margin: 1rem; | ||
} | ||
.this :global(.section-container) { | ||
border: 1px solid #c8c8c8; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.this :global(.section-header) { | ||
padding: 0.5rem 1rem 0.5rem; | ||
background-color: #eee; | ||
border: 1px solid #c8c8c8; | ||
font-weight: bold; | ||
} | ||
.scrollable { | ||
overflow-y: auto; | ||
} | ||
`}</style> | ||
<div className="section-header">{title}</div> | ||
<div className={classNames("section-container", { 'scrollable': scrollable })}> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
Section.propTypes = { | ||
/** Title of the section */ | ||
title: PropTypes.string.isRequired, | ||
/** List of child elements */ | ||
children: PropTypes.object, | ||
/** Whether the section should be scrollable */ | ||
scrollable: PropTypes.bool | ||
}; | ||
|
||
Section.defaultProps = { | ||
children: [], | ||
scrollable: false, | ||
}; | ||
|
||
export default Section; |
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