Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostShare block maintenance: localize, CSS migration and fixes, ESLint a11y fix #31022

Merged
merged 4 commits into from
Feb 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion assets/stylesheets/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
@import 'blocks/post-edit-button/style';
@import 'blocks/post-item/style';
@import 'blocks/post-likes/style';
@import 'blocks/post-share/style';
@import 'blocks/privacy-policy-banner/style';
@import 'blocks/sharing-preview-pane/style';
@import 'blocks/site-address-changer/style';
Expand Down
23 changes: 1 addition & 22 deletions client/blocks/post-share/connections-list.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
/** @format */

/**
* External dependencies
*/

import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import { localize } from 'i18n-calypso';

/**
* Internal dependencies
*/
import Connection from './connection';
import Notice from 'components/notice';
import NoticeAction from 'components/notice/notice-action';

class ConnectionsList extends PureComponent {
static propTypes = {
connections: PropTypes.array,
onToggle: PropTypes.func,
siteId: PropTypes.number,
siteSlug: PropTypes.string,

// connects and helpers
moment: PropTypes.func,
numberFormat: PropTypes.func,
translater: PropTypes.func,
};

static defaultProps = {
Expand Down Expand Up @@ -69,14 +58,4 @@ class ConnectionsList extends PureComponent {
}
}

export const NoConnectionsNotice = ( { siteSlug, translate } ) => (
<Notice
status="is-warning"
showDismiss={ false }
text={ translate( 'Connect an account to get started.' ) }
>
<NoticeAction href={ `/sharing/${ siteSlug }` }>{ translate( 'Settings' ) }</NoticeAction>
</Notice>
);

export default localize( ConnectionsList );
export default ConnectionsList;
22 changes: 10 additions & 12 deletions client/blocks/post-share/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,22 @@ import {
isRequestingSitePlans as siteIsRequestingPlans,
} from 'state/sites/plans/selectors';
import { FEATURE_REPUBLICIZE } from 'lib/plans/constants';
import { UpgradeToPremiumNudge } from 'blocks/post-share/nudges';
import { UpgradeToPremiumNudge } from './nudges';
import SharingPreviewModal from './sharing-preview-modal';
import ConnectionsList, { NoConnectionsNotice } from './connections-list';
import ConnectionsList from './connections-list';
import NoConnectionsNotice from './no-connections-notice';
import ActionsList from './publicize-actions-list';
import CalendarButton from 'blocks/calendar-button';
import EventsTooltip from 'components/date-picker/events-tooltip';
import analytics from 'lib/analytics';
import TrackComponentView from 'lib/analytics/track-component-view';
import { sectionify } from 'lib/route';

/**
* Style dependencies
*/
import './style.scss';

class PostShare extends Component {
static propTypes = {
// parent prps
Expand Down Expand Up @@ -318,7 +324,6 @@ class PostShare extends Component {
showOutsideDays={ false }
title={ translate( 'Set date and time' ) }
selectedDay={ this.state.scheduledDate }
tabIndex={ 3 }
siteId={ siteId }
onDateChange={ this.scheduleDate }
onDayMouseEnter={ this.showCalendarTooltip }
Expand Down Expand Up @@ -484,21 +489,14 @@ class PostShare extends Component {
}

renderPrimarySection() {
const { hasFetchedConnections, hasRepublicizeFeature, siteSlug, translate } = this.props;
const { hasFetchedConnections, hasRepublicizeFeature, siteSlug } = this.props;

if ( ! hasFetchedConnections ) {
return null;
}

if ( ! this.hasConnections() ) {
return (
<NoConnectionsNotice
{ ...{
siteSlug,
translate,
} }
/>
);
return <NoConnectionsNotice siteSlug={ siteSlug } />;
}

if ( ! hasRepublicizeFeature ) {
Expand Down
23 changes: 23 additions & 0 deletions client/blocks/post-share/no-connections-notice.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* External dependencies
*/
import React from 'react';
import { localize } from 'i18n-calypso';

/**
* Internal dependencies
*/
import Notice from 'components/notice';
import NoticeAction from 'components/notice/notice-action';

const NoConnectionsNotice = ( { siteSlug, translate } ) => (
<Notice
status="is-warning"
showDismiss={ false }
text={ translate( 'Connect an account to get started.' ) }
>
<NoticeAction href={ `/sharing/${ siteSlug }` }>{ translate( 'Settings' ) }</NoticeAction>
</Notice>
);

export default localize( NoConnectionsNotice );
11 changes: 7 additions & 4 deletions client/blocks/post-share/style.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

$section-border: solid 1px darken( $sidebar-bg-color, 5% );

.post-share .card.banner,
Expand All @@ -13,9 +12,13 @@ $section-border: solid 1px darken( $sidebar-bg-color, 5% );
position: relative;
background-color: var( --color-white );

& .notice {
margin: 0 0 16px;
border-radius: 0;
.notice {
margin-bottom: 0;

&,
.notice__icon-wrapper {
border-radius: 0;
}
}
}

Expand Down