Another large update for all components
reorganization, linting, updating file imports, consolidation warning: there will be errors in this commit todo: update webpack, add missing styles, scss files, consolidate group page components.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { length } from 'stringz';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import './character_counter.scss';
|
||||
|
||||
export default class CharacterCounter extends PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
text: PropTypes.string.isRequired,
|
||||
max: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
render () {
|
||||
const diff = this.props.max - length(this.props.text);
|
||||
|
||||
const classes = classNames('character-counter', {
|
||||
'character-counter--over': (diff < 0),
|
||||
});
|
||||
|
||||
<div className='character-counter__wrapper'>
|
||||
<span className={classes}>{diff}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
.character-counter {
|
||||
cursor: default;
|
||||
font-family: $font-sans-serif, sans-serif;
|
||||
color: $gab-secondary-text;
|
||||
|
||||
@include text-sizing(14px, 600);
|
||||
|
||||
&--over {
|
||||
color: $warning-red;
|
||||
}
|
||||
|
||||
&__wrapper {
|
||||
align-self: center;
|
||||
margin-right: 4px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './character_counter';
|
||||
Reference in New Issue
Block a user