Skip to content
Snippets Groups Projects
Commit eb832e88 authored by Yamagishi Kazutoshi's avatar Yamagishi Kazutoshi Committed by Eugen Rochko
Browse files

Replace TextIconButton for SensitiveButton to IconButton (#3759)

* Replace TextIconButton for SensitiveButton to IconButton

* line-height
parent b16b6935
No related branches found
No related tags found
No related merge requests found
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import TextIconButton from '../components/text_icon_button'; import classNames from 'classnames';
import IconButton from '../../../components/icon_button';
import { changeComposeSensitivity } from '../../../actions/compose'; import { changeComposeSensitivity } from '../../../actions/compose';
import Motion from 'react-motion/lib/Motion'; import Motion from 'react-motion/lib/Motion';
import spring from 'react-motion/lib/spring'; import spring from 'react-motion/lib/spring';
...@@ -38,11 +39,26 @@ class SensitiveButton extends React.PureComponent { ...@@ -38,11 +39,26 @@ class SensitiveButton extends React.PureComponent {
return ( return (
<Motion defaultStyle={{ scale: 0.87 }} style={{ scale: spring(visible ? 1 : 0.87, { stiffness: 200, damping: 3 }) }}> <Motion defaultStyle={{ scale: 0.87 }} style={{ scale: spring(visible ? 1 : 0.87, { stiffness: 200, damping: 3 }) }}>
{({ scale }) => {({ scale }) => {
<div style={{ display: visible ? 'block' : 'none', transform: `translateZ(0) scale(${scale})` }}> const icon = active ? 'eye-slash' : 'eye';
<TextIconButton onClick={onClick} label='NSFW' title={intl.formatMessage(messages.title)} active={active} /> const className = classNames('compose-form__sensitive-button', {
</div> 'compose-form__sensitive-button--visible': visible,
} });
return (
<div className={className} style={{ transform: `translateZ(0) scale(${scale})` }}>
<IconButton
className='compose-form__sensitive-button__icon'
title={intl.formatMessage(messages.title)}
icon={icon}
onClick={onClick}
size={18}
active={active}
style={{ lineHeight: null, height: null }}
inverted
/>
</div>
);
}}
</Motion> </Motion>
); );
} }
......
...@@ -306,6 +306,18 @@ ...@@ -306,6 +306,18 @@
line-height: 27px; line-height: 27px;
} }
.compose-form__sensitive-button {
display: none;
&.compose-form__sensitive-button--visible {
display: block;
}
.compose-form__sensitive-button__icon {
line-height: 27px;
}
}
.compose-form__upload-wrapper { .compose-form__upload-wrapper {
overflow: hidden; overflow: hidden;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment