Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add meta address support for specifying the hostname of an IP camera …
…URL (#471) (#478) * Update Space component * Map meta address to hostname for an IP camera URL (#471) * Update resource strings
- Loading branch information
Showing
17 changed files
with
97 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,51 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const Space = ({ componentClass: Component, width, ...props }) => { | ||
const Space = ({ tag: Component, width, height, ...props }) => { | ||
if ((typeof width === 'string') && width.match(/^\d+$/)) { | ||
width += 'px'; | ||
} | ||
if ((typeof height === 'string') && height.match(/^\d+$/)) { | ||
height += 'px'; | ||
} | ||
|
||
props.style = { | ||
display: 'inline-block', | ||
width: width, | ||
...props.style | ||
...props.style, | ||
}; | ||
|
||
if (width !== undefined) { | ||
props.style.width = width; | ||
} | ||
|
||
if (height !== undefined) { | ||
props.style.height = height; | ||
} | ||
|
||
return ( | ||
<Component {...props} /> | ||
); | ||
}; | ||
|
||
Space.propTypes = { | ||
componentClass: PropTypes.oneOfType([ | ||
tag: PropTypes.oneOfType([ | ||
PropTypes.node, | ||
PropTypes.string | ||
]), | ||
width: PropTypes.oneOfType([ | ||
PropTypes.number, | ||
PropTypes.string | ||
]) | ||
]), | ||
height: PropTypes.oneOfType([ | ||
PropTypes.number, | ||
PropTypes.string | ||
]), | ||
}; | ||
|
||
Space.defaultProps = { | ||
componentClass: 'span', | ||
width: 0 | ||
tag: 'div', | ||
width: 0, | ||
height: 0, | ||
}; | ||
|
||
export default Space; |
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
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
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
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