Background gradients, migrate from CSS to SCSS, remove !important
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import upperFirst from 'lodash/upperFirst';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import styles from './DueDate.module.css';
|
||||
import styles from './DueDate.module.scss';
|
||||
|
||||
const SIZES = {
|
||||
TINY: 'tiny',
|
||||
@@ -11,24 +12,6 @@ const SIZES = {
|
||||
MEDIUM: 'medium',
|
||||
};
|
||||
|
||||
// TODO: move to styles
|
||||
const STYLES = {
|
||||
tiny: {
|
||||
fontSize: '12px',
|
||||
lineHeight: '20px',
|
||||
padding: '0px 6px',
|
||||
},
|
||||
small: {
|
||||
fontSize: '12px',
|
||||
lineHeight: '20px',
|
||||
padding: '2px 6px',
|
||||
},
|
||||
medium: {
|
||||
lineHeight: '20px',
|
||||
padding: '6px 12px',
|
||||
},
|
||||
};
|
||||
|
||||
const FORMATS = {
|
||||
tiny: 'longDate',
|
||||
small: 'longDate',
|
||||
@@ -38,12 +21,14 @@ const FORMATS = {
|
||||
const DueDate = React.memo(({ value, size, isDisabled, onClick }) => {
|
||||
const [t] = useTranslation();
|
||||
|
||||
const style = {
|
||||
...STYLES[size],
|
||||
};
|
||||
|
||||
const contentNode = (
|
||||
<span className={classNames(styles.wrapper, onClick && styles.hoverable)} style={style}>
|
||||
<span
|
||||
className={classNames(
|
||||
styles.wrapper,
|
||||
styles[`wrapper${upperFirst(size)}`],
|
||||
onClick && styles.wrapperHoverable,
|
||||
)}
|
||||
>
|
||||
{t(`format:${FORMATS[size]}`, {
|
||||
value,
|
||||
postProcess: 'formatDate',
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
.button {
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.hoverable:hover {
|
||||
background: #d2d8dc;
|
||||
color: #17394d;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
background: #dce0e4;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
color: #6a808b;
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
text-align: left;
|
||||
transition: background 0.3s ease;
|
||||
vertical-align: top;
|
||||
}
|
||||
46
client/src/components/DueDate/DueDate.module.scss
Normal file
46
client/src/components/DueDate/DueDate.module.scss
Normal file
@@ -0,0 +1,46 @@
|
||||
:global(#app) {
|
||||
.button {
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
background: #dce0e4;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
color: #6a808b;
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
text-align: left;
|
||||
transition: background 0.3s ease;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wrapperHoverable:hover {
|
||||
background: #d2d8dc;
|
||||
color: #17394d;
|
||||
}
|
||||
|
||||
/* Sizes */
|
||||
|
||||
.wrapperTiny {
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
padding: 0px 6px;
|
||||
}
|
||||
|
||||
.wrapperSmall {
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
|
||||
.wrapperMedium {
|
||||
line-height: 20px;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user