-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DUOS-2789] Switch pages and components to JSX (#2397)
- Loading branch information
Showing
26 changed files
with
992 additions
and
1,118 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,80 @@ | ||
import {Component} from 'react'; | ||
import {div, hh, img, h2, span} from 'react-hyperscript-helpers'; | ||
import {isNil} from 'lodash'; | ||
import React from 'react'; | ||
import { isNil } from 'lodash'; | ||
|
||
export const PageHeading = hh(class PageHeading extends Component { | ||
const margins = (iconSize) => { | ||
|
||
margins(iconSize) { | ||
const MEDIUM = { | ||
marginLeft: '55px' | ||
}; | ||
|
||
const MEDIUM = { | ||
marginLeft: '55px' | ||
}; | ||
const LARGE = { | ||
marginLeft: '70px' | ||
}; | ||
|
||
const LARGE = { | ||
marginLeft: '70px' | ||
}; | ||
|
||
const NONE = { | ||
marginLeft: '0' | ||
}; | ||
|
||
if (iconSize === 'none') { | ||
return NONE; | ||
} | ||
if (iconSize === 'large') { | ||
return LARGE; | ||
} else { | ||
return MEDIUM; | ||
} | ||
} | ||
|
||
render() { | ||
|
||
const HEADING = { | ||
width: '100%', | ||
margin: '20px 0 10px 0', | ||
position: 'relative' | ||
}; | ||
|
||
const ICON = { | ||
position: 'absolute', | ||
top: '0', | ||
left: '0', | ||
height: '50px' | ||
}; | ||
|
||
const DESCRIPTION = { | ||
color: '#000000', | ||
height: '25px', | ||
fontWeight: '400', | ||
fontSize: '19px' | ||
}; | ||
|
||
const TITLE = { | ||
margin: '7px 0 5px 0', | ||
lineBreak: 'auto' | ||
}; | ||
|
||
const MARGINS = this.margins(this.props.iconSize); | ||
const DESCRIPT_STYLE = isNil(this.props.descriptionStyle) ? DESCRIPTION : this.props.descriptionStyle; | ||
|
||
return div({id: this.props.id + '_heading', style: HEADING}, [ | ||
img({ | ||
id: this.props.id + '_icon', | ||
isRendered: this.props.imgSrc !== undefined, | ||
src: this.props.imgSrc, | ||
alt: this.props.title, | ||
style: ICON | ||
}), | ||
div({style: MARGINS}, [ | ||
h2({ | ||
id: this.props.id + '_title', | ||
className: this.props.color + '-color', | ||
style: TITLE | ||
}, [this.props.title]), | ||
span({id: this.props.id + '_description', style: DESCRIPT_STYLE}, [this.props.description]), | ||
]), | ||
|
||
]); | ||
const NONE = { | ||
marginLeft: '0' | ||
}; | ||
|
||
if (iconSize === 'none') { | ||
return NONE; | ||
} else if (iconSize === 'large') { | ||
return LARGE; | ||
} else { | ||
return MEDIUM; | ||
} | ||
|
||
}); | ||
}; | ||
|
||
export const PageHeading = (props) => { | ||
const { id, title, description, imgSrc, color, iconSize, descriptionStyle } = props; | ||
|
||
const HEADING = { | ||
width: '100%', | ||
margin: '20px 0 10px 0', | ||
position: 'relative' | ||
}; | ||
|
||
const ICON = { | ||
position: 'absolute', | ||
top: '0', | ||
left: '0', | ||
height: '50px' | ||
}; | ||
|
||
const DESCRIPTION = { | ||
color: '#000000', | ||
height: '25px', | ||
fontWeight: '400', | ||
fontSize: '19px' | ||
}; | ||
|
||
const TITLE = { | ||
margin: '7px 0 5px 0', | ||
lineBreak: 'auto' | ||
}; | ||
|
||
const MARGINS = margins(iconSize); | ||
const DESCRIPT_STYLE = isNil(descriptionStyle) ? DESCRIPTION : descriptionStyle; | ||
|
||
return ( | ||
<div id={id + '_heading'} style={HEADING}> | ||
{imgSrc !== undefined && | ||
<img | ||
id={id + '_icon'} | ||
src={imgSrc} | ||
alt={title} | ||
style={ICON} | ||
/> | ||
} | ||
<div style={MARGINS}> | ||
<h2 id={id + '_title'} className={`${color}-color`} style={TITLE}> | ||
{title} | ||
</h2> | ||
<span id={id + '_description'} style={DESCRIPT_STYLE}> | ||
{description} | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PageHeading; |
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
Oops, something went wrong.