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

Framework: remove <Flag> component #1676

Merged
merged 6 commits into from
Dec 16, 2015
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 @@ -32,7 +32,6 @@
@import 'components/empty-content/style';
@import 'components/external-link/style';
@import 'components/feature-example/style';
@import 'components/flag/style';
@import 'components/foldable-card/style';
@import 'components/follow-button/style';
@import 'components/gauge/style';
Expand Down
11 changes: 6 additions & 5 deletions client/components/domains/domain-suggestion-flag/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* External dependencies
*/
var React = require( 'react' );
import React from 'react';

/**
* Internal dependencies
*/
var Flag = require( 'components/flag' );
import Notice from 'components/notice';

const DomainSuggestionFlag = React.createClass( {
propTypes: {
Expand All @@ -20,10 +20,11 @@ const DomainSuggestionFlag = React.createClass( {
return this.props.domain.endsWith( tld );
}, this ) ) {
return (
<Flag
type="is-success">
<Notice
isCompact
status="is-success">
{ this.translate( 'New', {context: 'Domain suggestion flag'} ) }
</Flag>
</Notice>
);
}

Expand Down
9 changes: 6 additions & 3 deletions client/components/domains/domain-suggestion/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@
margin: 8px 0 0 0;
}

.flag {
margin-left: 5px;
vertical-align: middle;
.notice.is-compact {
margin: 0 0 0 8px;
}

.notice__icon {
display: none;
}

.is-placeholder & {
Expand Down
31 changes: 0 additions & 31 deletions client/components/flag/README.md

This file was deleted.

38 changes: 0 additions & 38 deletions client/components/flag/docs/example.jsx

This file was deleted.

34 changes: 0 additions & 34 deletions client/components/flag/index.jsx

This file was deleted.

31 changes: 0 additions & 31 deletions client/components/flag/style.scss

This file was deleted.

8 changes: 6 additions & 2 deletions client/components/notice/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,23 @@
border-radius: 2px;
color: $white;
display: inline-flex;
flex-wrap: nowrap;
min-height: 20px;
margin: 8px;
margin: 0;
padding: 0;
text-decoration: none;
text-transform: none;
vertical-align: middle;

.notice__text {
font-size: 12px;
padding: 8px;
padding: 6px 8px;
line-height: 1;
}

.notice__icon {
align-self: center;
flex-shrink: 0;
padding: 0 0 0 8px;
width: 14px;
height: 14px;
Expand Down
2 changes: 0 additions & 2 deletions client/devdocs/design/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ var SearchCard = require( 'components/search-card' ),
InfoPopover = require( 'components/info-popover/docs/example' ),
FoldableCard = require( 'components/foldable-card/docs/example' ),
SectionHeader = require( 'components/section-header/docs/example' ),
Flag = require( 'components/flag/docs/example' ),
PaymentLogo = require( 'components/payment-logo/docs/example' ),
Count = require( 'components/count/docs/example' ),
Version = require( 'components/version/docs/example' ),
Expand Down Expand Up @@ -218,7 +217,6 @@ module.exports = React.createClass( {
<InputChrono />
<TimezoneDropdown />
<FoldableCard />
<Flag />
<PaymentLogo />
<BulkSelect />
<SectionHeader />
Expand Down
14 changes: 7 additions & 7 deletions client/me/purchases/list/item/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import classNames from 'classnames';
*/
import paths from '../../paths';
import CompactCard from 'components/card/compact';
import Flag from 'components/flag';
import Notice from 'components/notice';
import {
getName,
isExpired,
Expand All @@ -33,9 +33,9 @@ const PurchaseItem = React.createClass( {

if ( showCreditCardExpiringWarning( purchase ) ) {
return (
<Flag type="is-error" icon="noticon-warning">
<Notice isCompact status="is-error" icon="spam">
{ this.translate( 'Credit card expiring soon' ) }
</Flag>
</Notice>
);
}

Expand All @@ -48,14 +48,14 @@ const PurchaseItem = React.createClass( {
if ( isExpiring( purchase ) ) {
if ( purchase.expiryMoment < this.moment().add( 30, 'days' ) ) {
return (
<Flag type="is-error" icon="noticon-warning">
<Notice isCompact status="is-error" icon="spam">
{ this.translate( 'Expires %(timeUntilExpiry)s', {
args: {
timeUntilExpiry: purchase.expiryMoment.fromNow()
},
context: 'timeUntilExpiry is of the form "[number] [time-period] ago" i.e. "3 days ago"'
} ) }
</Flag>
</Notice>
);
}

Expand All @@ -66,14 +66,14 @@ const PurchaseItem = React.createClass( {

if ( isExpired( purchase ) ) {
return (
<Flag type="is-error" icon="noticon-warning">
<Notice isCompact status="is-error" icon="spam">
{ this.translate( 'Expired %(timeSinceExpiry)s', {
args: {
timeSinceExpiry: purchase.expiryMoment.fromNow()
},
context: 'timeSinceExpiry is of the form "[number] [time-period] ago" i.e. "3 days ago"'
} ) }
</Flag>
</Notice>
);
}

Expand Down
4 changes: 4 additions & 0 deletions client/my-sites/current-site/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,7 @@
content: '\f429';
}
}

.current-site .notice {
margin: 0 8px 8px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from 'react';
/**
* Internal dependencies
*/
import Flag from 'components/flag';
import Notice from 'components/notice';

const DomainPrimaryFlag = React.createClass( {
propTypes: {
Expand All @@ -16,12 +16,7 @@ const DomainPrimaryFlag = React.createClass( {
render() {
if ( this.props.domain.isPrimary ) {
return (
<Flag
className="is-primary"
type="is-success"
icon="noticon-checkmark">
{ this.translate( 'Primary Domain' ) }
</Flag>
<Notice isCompact status="is-success">{ this.translate( 'Primary Domain' ) }</Notice>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from 'react';
import analyticsMixin from 'lib/mixins/analytics';
import Card from 'components/card/compact';
import config from 'config';
import Flag from 'components/flag';
import Notice from 'components/notice';
import DomainWarnings from 'my-sites/upgrades/components/domain-warnings';
import Header from './card/header';
import paths from 'my-sites/upgrades/paths';
Expand Down Expand Up @@ -43,25 +43,27 @@ const RegisteredDomain = React.createClass( {
getPrivacyProtection() {
if ( this.props.domain.hasPrivacyProtection ) {
return (
<Flag
type="is-success"
icon="noticon-lock">
<Notice
isCompact
status="is-success"
icon="lock">
{ this.translate( 'On', {
context: 'An icon label when Privacy Protection is enabled.'
} ) }
</Flag>
</Notice>
);
}

return (
<Flag
type="is-warning"
icon="noticon-warning"
<Notice
isCompact
status="is-warning"
icon="notice"
onClick={ this.goToPrivacyProtection }>
{ this.translate( 'None', {
context: 'An icon label when Privacy Protection is disabled.'
} ) }
</Flag>
</Notice>
);
},

Expand Down