backpack-ui
Version:
Lonely Planet's Components
50 lines (41 loc) • 738 B
JSX
import React from "react";
function Bullet({ space, color }) {
const content = {
before: " •",
after: "• ",
both: " • ",
none: "•",
};
function markup(htmlContent) {
return {
__html: htmlContent,
};
}
return (
<span
style={{ color }}
aria-hidden="true"
dangerouslySetInnerHTML={markup(content[space])}
/>
);
}
Bullet.propTypes = {
/**
* Where a space should be placed
*/
space: React.PropTypes.oneOf([
"none",
"before",
"after",
"both",
]),
/**
* CSS color value
*/
color: React.PropTypes.string,
};
Bullet.defaultProps = {
space: "none",
color: "",
};
export default Bullet;