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

Improve bundling order #1024

Merged
merged 6 commits into from
Feb 21, 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
36 changes: 8 additions & 28 deletions src/components/Button/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
padding: 0;
}

.primaryButton {
.primaryButtonRoot {
@apply --marketplaceButtonStylesPrimary;

/* Clear padding that is set for link elements looking like buttons */
padding: 0;
}

.secondaryButton {
.secondaryButtonRoot {
@apply --marketplaceButtonStylesSecondary;

/* We must lift up the text from the center since it looks better with
Expand All @@ -23,35 +23,15 @@
padding: 0 0 2px 0;
}

.inlineTextButton {
.inlineTextButtonRoot {
@apply --marketplaceLinkStyles;
}

.inlineButton {
display: inline-block;

/* fill colors should be in sync with marketplace color palette */
background-color: transparent;

/* border-width should be in sync with marketplace strike-widths */
border-width: 0px;

/* Font configuration */
text-decoration: none;

/* Hovers */
&:enabled {
cursor: pointer;
}
&:enabled:hover,
&:enabled:active {
background-color: transparent;
text-decoration: underline;
}
&:disabled {
background-color: transparent;
cursor: auto;
}
.primaryButton {
/* Class handle for primary button state styles */
}
.secondaryButton {
/* Class handle for secondary button state styles */
}

.inProgress {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const ButtonsComponent = () => {
</a>

<h3>Button with custom styles:</h3>
<Button className={css.customButton}>Click me</Button>
<Button rootClassName={css.customButton}>Click me</Button>
</div>
);
};
Expand Down
15 changes: 12 additions & 3 deletions src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,20 @@ Button.propTypes = {

export default Button;

export const PrimaryButton = props => <Button {...props} rootClassName={css.primaryButton} />;
export const PrimaryButton = props => {
const classes = classNames(props.rootClassName || css.primaryButtonRoot, css.primaryButton);
return <Button {...props} rootClassName={classes} />;
};
PrimaryButton.displayName = 'PrimaryButton';

export const SecondaryButton = props => <Button {...props} rootClassName={css.secondaryButton} />;
export const SecondaryButton = props => {
const classes = classNames(props.rootClassName || css.secondaryButtonRoot, css.secondaryButton);
return <Button {...props} rootClassName={classes} />;
};
SecondaryButton.displayName = 'SecondaryButton';

export const InlineTextButton = props => <Button {...props} rootClassName={css.inlineTextButton} />;
export const InlineTextButton = props => {
const classes = classNames(props.rootClassName || css.inlineTextButtonRoot, css.inlineTextButton);
return <Button {...props} rootClassName={classes} />;
};
InlineTextButton.displayName = 'InlineTextButton';
6 changes: 2 additions & 4 deletions src/components/ManageListingCard/ManageListingCard.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@
}

.menuContent {
visibility: hidden;
opacity: 0;
pointer-events: none;

position: absolute;
right: 0;
z-index: var(--zIndexPopup);
Expand All @@ -168,6 +164,7 @@
}

.menuItem {
@apply --marketplaceLinkStyles;
@apply --marketplaceH5FontStyles;
color: var(--matterColorLight);
font-weight: var(--fontWeightMedium);
Expand Down Expand Up @@ -273,6 +270,7 @@
}

.title {
@apply --marketplaceLinkStyles;
/* Font */
@apply --marketplaceH3FontStyles;
color: var(--matterColor);
Expand Down
4 changes: 2 additions & 2 deletions src/components/ManageListingCard/ManageListingCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const ManageListingCardComponent = props => {
<MenuContent rootClassName={css.menuContent}>
<MenuItem key="close-listing">
<InlineTextButton
className={menuItemClasses}
rootClassName={menuItemClasses}
onClick={event => {
event.preventDefault();
event.stopPropagation();
Expand Down Expand Up @@ -315,7 +315,7 @@ export const ManageListingCardComponent = props => {
<div className={css.mainInfo}>
<div className={css.titleWrapper}>
<InlineTextButton
className={titleClasses}
rootClassName={titleClasses}
onClick={event => {
event.preventDefault();
event.stopPropagation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ exports[`ManageListingCard matches snapshot 1`] = `
rootClassName=""
>
<InlineTextButton
className=""
onClick={[Function]}
rootClassName=""
>
<FormattedMessage
id="ManageListingCard.closeListing"
Expand Down Expand Up @@ -109,8 +109,8 @@ exports[`ManageListingCard matches snapshot 1`] = `
<div>
<div>
<InlineTextButton
className=""
onClick={[Function]}
rootClassName=""
>
<span
key="1"
Expand Down
53 changes: 0 additions & 53 deletions src/components/MapPanel/MapPanel.css

This file was deleted.

25 changes: 0 additions & 25 deletions src/components/MapPanel/MapPanel.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/components/MapPanel/MapPanel.test.js

This file was deleted.

20 changes: 0 additions & 20 deletions src/components/MapPanel/__snapshots__/MapPanel.test.js.snap

This file was deleted.

10 changes: 6 additions & 4 deletions src/components/MenuContent/MenuContent.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
@import '../../marketplace.css';

.root {
visibility: hidden;
opacity: 0;
pointer-events: none;

position: absolute;
z-index: var(--zIndexPopup);

Expand All @@ -15,6 +11,12 @@
transition: var(--transitionStyleButton);
}

.isClosed {
visibility: hidden;
opacity: 0;
pointer-events: none;
}

.isOpen {
visibility: visible;
opacity: 1;
Expand Down
3 changes: 2 additions & 1 deletion src/components/MenuContent/MenuContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const MenuContent = props => {
} = props;

const rootClass = rootClassName || css.root;
const classes = classNames(rootClass, className, { [css.isOpen]: isOpen });
const openClasses = isOpen ? css.isOpen : css.isClosed;
const classes = classNames(rootClass, className, openClasses);
const contentClasses = classNames(contentClassName || css.content);

const arrowPositionStyle =
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModalMissingInformation/EmailReminder.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const EmailReminder = props => {
const email = user.id ? <span className={css.email}>{user.attributes.email}</span> : '';

const resendEmailLink = (
<InlineTextButton className={css.helperLink} onClick={onResendVerificationEmail}>
<InlineTextButton rootClassName={css.helperLink} onClick={onResendVerificationEmail}>
<FormattedMessage id="ModalMissingInformation.resendEmailLinkText" />
</InlineTextButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
}

.helperLink {
@apply --marketplaceLinkStyles;
@apply --marketplaceModalHelperLink;
}

Expand Down
13 changes: 13 additions & 0 deletions src/components/SearchFiltersMobile/SearchFiltersMobile.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@
}

.filtersButton {
@apply --marketplaceButtonStylesSecondary;
@apply --marketplaceTinyFontStyles;
font-weight: var(--fontWeightBold);

height: 35px;
min-height: 35px;
padding: 0 18px;
margin: 0 9px 0 0;
border-radius: 4px;
}

.filtersButtonSelected {
@apply --marketplaceButtonStyles;
@apply --marketplaceTinyFontStyles;
font-weight: var(--fontWeightBold);

Expand Down
17 changes: 5 additions & 12 deletions src/components/SearchFiltersMobile/SearchFiltersMobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import routeConfiguration from '../../routeConfiguration';
import { parseDateFromISO8601, stringifyDateToISO8601 } from '../../util/dates';
import { createResourceLocatorString } from '../../util/routes';
import {
SecondaryButton,
ModalInMobile,
Button,
PriceFilter,
Expand Down Expand Up @@ -204,16 +203,8 @@ class SearchFiltersMobileComponent extends Component {
{ count: resultsCount }
);

const filtersButton =
selectedFiltersCount > 0 ? (
<Button className={css.filtersButton} onClick={this.openFilters}>
<FormattedMessage id="SearchFilters.filtersButtonLabel" className={css.mapIconText} />
</Button>
) : (
<SecondaryButton className={css.filtersButton} onClick={this.openFilters}>
<FormattedMessage id="SearchFilters.filtersButtonLabel" className={css.mapIconText} />
</SecondaryButton>
);
const filtersButtonClasses =
selectedFiltersCount > 0 ? css.filtersButtonSelected : css.filtersButton;

const categoryLabel = intl.formatMessage({
id: 'SearchFiltersMobile.categoryLabel',
Expand Down Expand Up @@ -284,7 +275,9 @@ class SearchFiltersMobileComponent extends Component {
{searchInProgress ? loadingResults : null}
</div>
<div className={css.buttons}>
{filtersButton}
<Button rootClassName={filtersButtonClasses} onClick={this.openFilters}>
<FormattedMessage id="SearchFilters.filtersButtonLabel" className={css.mapIconText} />
</Button>
<div className={css.mapIcon} onClick={onMapIconClick}>
<FormattedMessage id="SearchFilters.openMapView" className={css.mapIconText} />
</div>
Expand Down
Loading