From cca41ea544fe7de3e7afdc250992a1c6e48d2a31 Mon Sep 17 00:00:00 2001 From: Stephen Burgess Date: Sat, 22 Apr 2017 21:26:55 -0500 Subject: [PATCH] Replace inline styles with CSS classes (BEM) (#2338) * fix(classnames): Status icon style classnames Take out inline css and put into classnames for the following components: account, avatar, icon button, status action bar, notification. * fix(status): Move styles from inline to classes for statuses Move styles to classnames in components.scss for the following components: display name media gallery status status content video player * fix(classnames): Add classnames to rest of components Take out inline styles and apply them to classnames in the sass for the following components: button column back button slim column back button collapsable column dropdown menu loading indicator status list * fix(classnames): Remove all non-dynamic inline styles Components affected: autosuggested permalink action bar header character counter compose form emoji dropdown privacy dropdown reply indicator upload form account auth followers getting started column settings mutes settings reblogs status checkbox report action bar status card boost modal media modal video modal * fix(permalink): Do not lose classname * fix(tests): Add space back in display name * fix(status__wrapper): Remove duplicate css name Remove incorrect style attribute. Remove style attribute all together. Cursor defaults to "auto" when not specified as 'default'. * fix(nl): do not lose translations --- .../components/components/account.jsx | 11 +- .../components/autosuggest_textarea.jsx | 5 +- .../components/components/avatar.jsx | 2 +- .../components/components/button.jsx | 16 +- .../components/column_back_button.jsx | 7 +- .../components/column_back_button_slim.jsx | 22 +- .../components/column_collapsable.jsx | 14 +- .../components/components/display_name.jsx | 4 +- .../components/components/dropdown_menu.jsx | 12 +- .../components/components/icon_button.jsx | 5 + .../components/loading_indicator.jsx | 9 +- .../components/components/media_gallery.jsx | 87 +- .../components/components/permalink.jsx | 5 +- .../components/components/status.jsx | 12 +- .../components/status_action_bar.jsx | 10 +- .../components/components/status_content.jsx | 6 +- .../components/components/status_list.jsx | 2 +- .../components/components/video_player.jsx | 92 +-- .../account/components/action_bar.jsx | 15 +- .../features/account/components/header.jsx | 6 +- .../account_timeline/components/header.jsx | 2 +- .../components/autosuggest_account.jsx | 4 +- .../compose/components/autosuggest_status.jsx | 2 +- .../compose/components/character_counter.jsx | 4 +- .../compose/components/compose_form.jsx | 14 +- .../components/emoji_picker_dropdown.jsx | 14 +- .../compose/components/navigation_bar.jsx | 8 +- .../compose/components/privacy_dropdown.jsx | 7 +- .../compose/components/reply_indicator.jsx | 8 +- .../compose/components/upload_button.jsx | 9 +- .../compose/components/upload_form.jsx | 8 +- .../compose/components/upload_progress.jsx | 4 +- .../components/account_authorize.jsx | 31 +- .../components/features/followers/index.jsx | 2 +- .../components/features/following/index.jsx | 2 +- .../features/getting_started/index.jsx | 2 +- .../components/column_settings.jsx | 27 +- .../home_timeline/components/setting_text.jsx | 10 - .../components/features/mutes/index.jsx | 3 +- .../components/column_settings.jsx | 33 +- .../notifications/components/notification.jsx | 14 +- .../components/setting_toggle.jsx | 17 +- .../components/features/reblogs/index.jsx | 2 +- .../report/components/status_check_box.jsx | 5 +- .../components/features/report/index.jsx | 17 +- .../features/status/components/action_bar.jsx | 8 +- .../features/status/components/card.jsx | 19 +- .../status/components/detailed_status.jsx | 22 +- .../components/features/status/index.jsx | 2 +- .../features/ui/components/boost_modal.jsx | 8 +- .../features/ui/components/column_header.jsx | 2 +- .../features/ui/components/column_link.jsx | 17 +- .../features/ui/components/columns_area.jsx | 8 +- .../features/ui/components/media_modal.jsx | 42 +- .../features/ui/components/modal_root.jsx | 2 +- .../features/ui/components/video_modal.jsx | 9 +- .../javascripts/components/locales/nl.jsx | 2 +- app/assets/stylesheets/components.scss | 779 ++++++++++++++++-- 58 files changed, 903 insertions(+), 608 deletions(-) diff --git a/app/assets/javascripts/components/components/account.jsx b/app/assets/javascripts/components/components/account.jsx index 18197380ecd..57c631d29cb 100644 --- a/app/assets/javascripts/components/components/account.jsx +++ b/app/assets/javascripts/components/components/account.jsx @@ -14,11 +14,6 @@ const messages = defineMessages({ unmute: { id: 'account.unmute', defaultMessage: 'Unmute' } }); -const buttonsStyle = { - padding: '10px', - height: '18px' -}; - class Account extends React.PureComponent { constructor (props, context) { @@ -68,13 +63,13 @@ class Account extends React.PureComponent { return (
-
+
-
+
-
+
{buttons}
diff --git a/app/assets/javascripts/components/components/autosuggest_textarea.jsx b/app/assets/javascripts/components/components/autosuggest_textarea.jsx index 90eb5b6a13b..d548eeeca91 100644 --- a/app/assets/javascripts/components/components/autosuggest_textarea.jsx +++ b/app/assets/javascripts/components/components/autosuggest_textarea.jsx @@ -150,8 +150,7 @@ class AutosuggestTextarea extends React.Component { render () { const { value, suggestions, disabled, placeholder, onKeyUp } = this.props; const { suggestionsHidden, selectedSuggestion } = this.state; - const className = 'autosuggest-textarea__textarea'; - const style = { direction: 'ltr' }; + const style = { direction: 'ltr' }; if (isRtl(value)) { style.direction = 'rtl'; @@ -161,7 +160,7 @@ class AutosuggestTextarea extends React.Component {