From 44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Mon, 20 Feb 2023 03:20:59 +0100 Subject: Rename JSX files with proper `.jsx` extension (#23733) --- .../containers/sensitive_button_container.jsx | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx (limited to 'app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx') diff --git a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx new file mode 100644 index 000000000..1bcce5731 --- /dev/null +++ b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx @@ -0,0 +1,71 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import classNames from 'classnames'; +import { changeComposeSensitivity } from 'mastodon/actions/compose'; +import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; + +const messages = defineMessages({ + marked: { + id: 'compose_form.sensitive.marked', + defaultMessage: '{count, plural, one {Media is marked as sensitive} other {Media is marked as sensitive}}', + }, + unmarked: { + id: 'compose_form.sensitive.unmarked', + defaultMessage: '{count, plural, one {Media is not marked as sensitive} other {Media is not marked as sensitive}}', + }, +}); + +const mapStateToProps = state => ({ + active: state.getIn(['compose', 'sensitive']), + disabled: state.getIn(['compose', 'spoiler']), + mediaCount: state.getIn(['compose', 'media_attachments']).size, +}); + +const mapDispatchToProps = dispatch => ({ + + onClick () { + dispatch(changeComposeSensitivity()); + }, + +}); + +class SensitiveButton extends React.PureComponent { + + static propTypes = { + active: PropTypes.bool, + disabled: PropTypes.bool, + mediaCount: PropTypes.number, + onClick: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + }; + + render () { + const { active, disabled, mediaCount, onClick, intl } = this.props; + + return ( +
+ +
+ ); + } + +} + +export default connect(mapStateToProps, mapDispatchToProps)(injectIntl(SensitiveButton)); -- cgit From d3b4d4d4f3ccee19f272c66e7c9acd803661e65b Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 20 Feb 2023 11:32:27 +0100 Subject: Change compose form checkbox to native input with `appearance: none` (#22949) --- .../features/compose/containers/sensitive_button_container.jsx | 2 -- app/javascript/styles/mastodon/components.scss | 8 +++----- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx') diff --git a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx index 1bcce5731..03f831d28 100644 --- a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx +++ b/app/javascript/mastodon/features/compose/containers/sensitive_button_container.jsx @@ -54,8 +54,6 @@ class SensitiveButton extends React.PureComponent { disabled={disabled} /> - - [data-popper-placement] { } input[type='checkbox'] { - display: none; - } - - .checkbox { + appearance: none; display: inline-block; position: relative; border: 1px solid $ui-primary-color; @@ -420,8 +417,9 @@ body > [data-popper-placement] { top: -1px; border-radius: 4px; vertical-align: middle; + cursor: inherit; - &.active { + &:checked { border-color: $highlight-text-color; background: $highlight-text-color url("data:image/svg+xml;utf8,") -- cgit