diff options
author | kibigo! <marrus-sh@users.noreply.github.com> | 2017-12-29 14:55:06 -0800 |
---|---|---|
committer | kibigo! <marrus-sh@users.noreply.github.com> | 2018-01-04 18:23:46 -0800 |
commit | 083170bec755920b80c64f9cca2cc419831f66c8 (patch) | |
tree | 7d15f95360fab7e76bad7e8d8f76667215d25b78 /app/javascript/flavours/glitch/features | |
parent | 8713659dffc884c65376091d3731c8074ac581e4 (diff) |
WIP <Compose> Refactor; SCSS ed.
Diffstat (limited to 'app/javascript/flavours/glitch/features')
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/options/index.js | 7 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/publisher/index.js | 3 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/reply/index.js | 9 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/textarea/index.js | 3 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/textarea/suggestions/index.js | 8 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js | 4 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/upload_form/item/index.js | 1 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/drawer/account/index.js (renamed from app/javascript/flavours/glitch/features/drawer/pager/account/index.js) | 4 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/drawer/index.js | 33 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/drawer/pager/index.js | 43 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js | 8 |
11 files changed, 41 insertions, 82 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/options/index.js b/app/javascript/flavours/glitch/features/composer/options/index.js index ee633e865..ea998a421 100644 --- a/app/javascript/flavours/glitch/features/composer/options/index.js +++ b/app/javascript/flavours/glitch/features/composer/options/index.js @@ -236,7 +236,12 @@ export default class ComposerOptions extends React.PureComponent { }} > {({ scale }) => ( - <div style={{ transform: `scale(${scale})` }}> + <div + style={{ + display: hasMedia ? null : 'none', + transform: `scale(${scale})`, + }} + > <IconButton active={sensitive} className='sensitive' diff --git a/app/javascript/flavours/glitch/features/composer/publisher/index.js b/app/javascript/flavours/glitch/features/composer/publisher/index.js index 85de80a9f..79337100f 100644 --- a/app/javascript/flavours/glitch/features/composer/publisher/index.js +++ b/app/javascript/flavours/glitch/features/composer/publisher/index.js @@ -49,6 +49,7 @@ export default function ComposerPublisher ({ <span class='count'>{diff}</span> {sideArm && sideArm !== 'none' ? ( <Button + className='side_arm' text={ <span> <Icon @@ -67,7 +68,7 @@ export default function ComposerPublisher ({ /> ) : null} <Button - className='compose-form__publish__primary' + className='primary' text={function () { switch (true) { case !!sideArm && sideArm !== 'none': diff --git a/app/javascript/flavours/glitch/features/composer/reply/index.js b/app/javascript/flavours/glitch/features/composer/reply/index.js index 2823415d2..4a52cddb4 100644 --- a/app/javascript/flavours/glitch/features/composer/reply/index.js +++ b/app/javascript/flavours/glitch/features/composer/reply/index.js @@ -70,24 +70,31 @@ export default class ComposerReply extends React.PureComponent { <article className='composer--reply'> <header> <IconButton + className='cancel' icon='times' onClick={click} title={intl.formatMessage(messages.cancel)} /> {account ? ( <a + className='account' href={account.get('url')} onClick={clickAccount} > <Avatar account={account} + className='avatar' size={24} /> - <DisplayName account={account} /> + <DisplayName + account={account} + className='display_name' + /> </a> ) : null} </header> <div + className='content' dangerouslySetInnerHTML={{ __html: content || '' }} style={{ direction: isRtl(content) ? 'rtl' : 'ltr' }} /> diff --git a/app/javascript/flavours/glitch/features/composer/textarea/index.js b/app/javascript/flavours/glitch/features/composer/textarea/index.js index ad0a35d7f..2299757df 100644 --- a/app/javascript/flavours/glitch/features/composer/textarea/index.js +++ b/app/javascript/flavours/glitch/features/composer/textarea/index.js @@ -246,12 +246,13 @@ export default class ComposerTextarea extends React.Component { // The result. return ( - <div className='autosuggest-textarea'> + <div className='composer--textarea'> <label> <span {...hiddenComponent}><FormattedMessage {...messages.placeholder} /></span> <Textarea aria-autocomplete='list' autoFocus={autoFocus} + className='textarea' disabled={disabled} inputRef={refTextarea} onBlur={blur} diff --git a/app/javascript/flavours/glitch/features/composer/textarea/suggestions/index.js b/app/javascript/flavours/glitch/features/composer/textarea/suggestions/index.js index b90696910..65ed2c18a 100644 --- a/app/javascript/flavours/glitch/features/composer/textarea/suggestions/index.js +++ b/app/javascript/flavours/glitch/features/composer/textarea/suggestions/index.js @@ -1,5 +1,4 @@ // Package imports. -import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; @@ -14,10 +13,13 @@ export default function ComposerTextareaSuggestions ({ suggestions, value, }) { - const computedClass = classNames('comoser--textarea--suggestions', { hidden: hidden || suggestions.isEmpty() }); + // The result. return ( - <div className={computedClass}> + <div + className='composer--textarea--suggestions' + hidden={hidden || suggestions.isEmpty()} + > {!hidden ? suggestions.map( (suggestion, index) => ( <ComposerTextareaSuggestionsItem diff --git a/app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js b/app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js index 08c99ed0e..b78f99ee9 100644 --- a/app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js +++ b/app/javascript/flavours/glitch/features/composer/textarea/suggestions/item/index.js @@ -50,10 +50,10 @@ export default class ComposerTextareaSuggestionsItem extends React.Component { // The result. return ( <div - role='button' - tabIndex='0' className={computedClass} onMouseDown={click} + role='button' + tabIndex='0' > { // If the suggestion is an object, then we render an emoji. // Otherwise, we render an account. diff --git a/app/javascript/flavours/glitch/features/composer/upload_form/item/index.js b/app/javascript/flavours/glitch/features/composer/upload_form/item/index.js index bd67e7227..cbec5ecd9 100644 --- a/app/javascript/flavours/glitch/features/composer/upload_form/item/index.js +++ b/app/javascript/flavours/glitch/features/composer/upload_form/item/index.js @@ -139,6 +139,7 @@ export default class ComposerUploadFormItem extends React.PureComponent { }} > <IconButton + className='close' icon='times' onClick={remove} size={36} diff --git a/app/javascript/flavours/glitch/features/drawer/pager/account/index.js b/app/javascript/flavours/glitch/features/drawer/account/index.js index 2ee95d5b9..9afe8ba3e 100644 --- a/app/javascript/flavours/glitch/features/drawer/pager/account/index.js +++ b/app/javascript/flavours/glitch/features/drawer/account/index.js @@ -22,7 +22,7 @@ const messages = defineMessages({ }); // The component. -export default function DrawerPagerAccount ({ account }) { +export default function DrawerAccount ({ account }) { // We need an account to render. if (!account) { @@ -67,4 +67,4 @@ export default function DrawerPagerAccount ({ account }) { ); } -DrawerPagerAccount.propTypes = { account: ImmutablePropTypes.map }; +DrawerAccount.propTypes = { account: ImmutablePropTypes.map }; diff --git a/app/javascript/flavours/glitch/features/drawer/index.js b/app/javascript/flavours/glitch/features/drawer/index.js index 1b7a8a0b5..d184dfd9b 100644 --- a/app/javascript/flavours/glitch/features/drawer/index.js +++ b/app/javascript/flavours/glitch/features/drawer/index.js @@ -4,7 +4,6 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; // Actions. -import { changeComposing } from 'flavours/glitch/actions/compose'; import { openModal } from 'flavours/glitch/actions/modal'; import { changeSearch, @@ -14,8 +13,9 @@ import { } from 'flavours/glitch/actions/search'; // Components. +import Composer from 'flavours/glitch/features/composer'; +import DrawerAccount from './account'; import DrawerHeader from './header'; -import DrawerPager from './pager'; import DrawerResults from './results'; import DrawerSearch from './search'; @@ -27,7 +27,6 @@ import { wrap } from 'flavours/glitch/util/redux_helpers'; const mapStateToProps = state => ({ account: state.getIn(['accounts', me]), columns: state.getIn(['settings', 'columns']), - isComposing: state.getIn(['compose', 'is_composing']), results: state.getIn(['search', 'results']), searchHidden: state.getIn(['search', 'hidden']), searchValue: state.getIn(['search', 'value']), @@ -39,12 +38,6 @@ const mapDispatchToProps = dispatch => ({ change (value) { dispatch(changeSearch(value)); }, - changeComposingOff () { - dispatch(changeComposing(false)); - }, - changeComposingOn () { - dispatch(changeComposing(true)); - }, clear () { dispatch(clearSearch()); }, @@ -72,8 +65,6 @@ class Drawer extends React.Component { const { dispatch: { change, - changeComposingOff, - changeComposingOn, clear, openSettings, show, @@ -84,7 +75,6 @@ class Drawer extends React.Component { state: { account, columns, - isComposing, results, searchHidden, searchValue, @@ -111,16 +101,14 @@ class Drawer extends React.Component { submitted={submitted} value={searchValue} /> - <DrawerPager - account={account} - active={isComposing} - onBlur={changeComposingOff} - onFocus={changeComposingOn} - /> - <DrawerResults - results={results} - visible={submitted && !searchHidden} - /> + <div className='contents'> + <DrawerAccount account={account} /> + <Composer /> + <DrawerResults + results={results} + visible={submitted && !searchHidden} + /> + </div> </div> ); } @@ -135,7 +123,6 @@ Drawer.propTypes = { state: PropTypes.shape({ account: ImmutablePropTypes.map, columns: ImmutablePropTypes.list, - isComposing: PropTypes.bool, results: ImmutablePropTypes.map, searchHidden: PropTypes.bool, searchValue: PropTypes.string, diff --git a/app/javascript/flavours/glitch/features/drawer/pager/index.js b/app/javascript/flavours/glitch/features/drawer/pager/index.js deleted file mode 100644 index 8dc2d3ee9..000000000 --- a/app/javascript/flavours/glitch/features/drawer/pager/index.js +++ /dev/null @@ -1,43 +0,0 @@ -// Package imports. -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; - -// Components. -import IconButton from 'flavours/glitch/components/icon_button'; -import Composer from 'flavours/glitch/features/composer'; -import DrawerPagerAccount from './account'; - -// The component. -export default function DrawerPager ({ - account, - active, - onClose, - onFocus, -}) { - const computedClass = classNames('drawer--pager', { active }); - - // The result. - return ( - <div - className={computedClass} - onFocus={onFocus} - > - <DrawerPagerAccount account={account} /> - <IconButton - icon='close' - onClick={onClose} - title='' - /> - <Composer /> - </div> - ); -} - -DrawerPager.propTypes = { - account: ImmutablePropTypes.map, - active: PropTypes.bool, - onClose: PropTypes.func, - onFocus: PropTypes.func, -}; diff --git a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js index 749bbbd86..91a83f330 100644 --- a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js @@ -7,13 +7,11 @@ import ReactSwipeableViews from 'react-swipeable-views'; import classNames from 'classnames'; import Permalink from 'flavours/glitch/components/permalink'; import { WrappedComponent as RawComposer } from 'flavours/glitch/features/composer'; -import DrawerPagerAccount from 'flavours/glitch/features/drawer/pager/account'; +import DrawerAccount from 'flavours/glitch/features/drawer/account'; import DrawerSearch from 'flavours/glitch/features/drawer/search'; import ColumnHeader from './column_header'; import { me } from 'flavours/glitch/util/initial_state'; -const noop = () => { }; - const messages = defineMessages({ home_title: { id: 'column.home', defaultMessage: 'Home' }, notifications_title: { id: 'column.notifications', defaultMessage: 'Notifications' }, @@ -49,7 +47,7 @@ const PageTwo = ({ intl, myAccount }) => ( <div className='onboarding-modal__page onboarding-modal__page-two'> <div className='figure non-interactive'> <div className='pseudo-drawer'> - <DrawerPagerAccount account={myAccount} /> + <DrawerAccount account={myAccount} /> <RawComposer intl={intl} state={composerState} @@ -72,7 +70,7 @@ const PageThree = ({ intl, myAccount }) => ( <DrawerSearch intl={intl} /> <div className='pseudo-drawer'> - <DrawerPagerAccount account={myAccount} /> + <DrawerAccount account={myAccount} /> </div> </div> |