Files
shields/frontend/components/common.js
T
dependabot[bot]andPaul Melnikow 860c426a0c Bump eslint-plugin-react from 7.11.1 to 7.12.0 (#2609)
* Bump eslint-plugin-react from 7.11.1 to 7.12.0

Bumps [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) from 7.11.1 to 7.12.0.
- [Release notes](https://github.com/yannickcr/eslint-plugin-react/releases)
- [Changelog](https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yannickcr/eslint-plugin-react/compare/v7.11.1...v7.12.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Fix lint errors

* Better link

* Re-bump package version and remove lint disable
2019-01-01 21:22:09 -05:00

106 lines
1.7 KiB
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import styled, { css } from 'styled-components'
const nonBreakingSpace = '\u00a0'
const BaseFont = styled.div`
font-family: Lekton, sans-serif;
color: #534;
`
const H2 = styled.h2`
font-style: italic;
margin-top: 12mm;
font-variant: small-caps;
::before {
content: '☙ ';
}
::after {
content: ' ❧';
}
`
const H3 = styled.h3`
font-style: italic;
`
const BadgeWrapper = styled.span`
padding: 2px;
height: ${({ height }) => height};
vertical-align: middle;
display: ${({ display }) => display};
${({ clickable }) =>
clickable &&
css`
cursor: pointer;
`};
`
const Badge = ({
src,
alt = '',
display = 'inline',
height = '20px',
clickable = false,
...rest
}) => (
<BadgeWrapper height={height} clickable={clickable} display={display}>
{src ? <img src={src} alt={alt} {...rest} /> : nonBreakingSpace}
</BadgeWrapper>
)
Badge.propTypes = {
src: PropTypes.string.isRequired,
alt: PropTypes.string,
display: PropTypes.oneOf(['inline', 'block', 'inline-block']),
height: PropTypes.string,
clickable: PropTypes.bool,
}
const StyledInput = styled.input`
height: 15px;
border: solid #b9a;
border-width: 0 0 1px 0;
padding: 0;
text-align: center;
color: #534;
:focus {
outline: 0;
}
`
const InlineInput = styled(StyledInput)`
width: 70px;
margin-left: 5px;
margin-right: 5px;
`
const BlockInput = styled(StyledInput)`
width: 40%;
background-color: transparent;
`
const VerticalSpace = styled.hr`
border: 0;
display: block;
height: 3mm;
`
export {
nonBreakingSpace,
BaseFont,
H2,
H3,
Badge,
InlineInput,
BlockInput,
VerticalSpace,
}