Skip to content

Commit

Permalink
Merge aa7ac54 into cf63be7
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoMA committed Mar 26, 2019
2 parents cf63be7 + aa7ac54 commit dc5498d
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 34 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fix

- Fix proptypes warnings.

## [2.6.14] - 2019-03-18

### Added

- sectionLinks now contains the prop `target` in links where is possible to use one of the values `[_self_, _blank_]`. That will define the value for target attribute. `<a href="/" target="_self">`

## [2.6.13] - 2019-03-14

### Changed

- Change language files to most generic.

## [2.6.12] - 2019-03-07
Expand Down
3 changes: 0 additions & 3 deletions react/__tests__/__snapshots__/Footer.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ exports[`<Footer /> component should match the snapshot 1`] = `
<div
class="listContainer pl0 w-100 mt0-ns"
>
<span
class="listTitle t-small ma0 db ttu"
/>
<ul
class="list list flex flex-column flex-wrap pa0 mb0 mt3"
>
Expand Down
6 changes: 4 additions & 2 deletions react/components/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import footer from '../footer.css'
class Accordion extends Component {
static propTypes = {
/** Title shown in Accordion */
title: PropTypes.string.isRequired,
title: PropTypes.string,
/** Accordion children. Components shown inside Collapse */
children: PropTypes.node.isRequired,
/** Internationalization */
Expand All @@ -22,7 +22,9 @@ class Accordion extends Component {
}

translate = id => {
return this.props.intl.messages[id] ? this.props.intl.formatMessage({ id }) : id
return this.props.intl.messages[id]
? this.props.intl.formatMessage({ id })
: id
}

render() {
Expand Down
26 changes: 14 additions & 12 deletions react/components/FooterLinkList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ import React from 'react'
import footerList from './footerList'
import footer from '../footer.css'


export const FooterLinkItem = ({ url, title, target }) => (
<a
className={`${footer.listLink} dib no-underline underline-hover mb0 mt2 w-100 t-small truncate c-muted-1 pointer`}
href={url}
target={target ? target : '_self'}
>
{title}
</a>
)
export const FooterLinkItem = ({ url, title, target }) =>
title ? (
<a
className={`${
footer.listLink
} dib no-underline underline-hover mb0 mt2 w-100 t-small truncate c-muted-1 pointer`}
href={url}
target={target ? target : '_self'}
>
{title}
</a>
) : null

FooterLinkItem.displayName = 'FooterLinkItem'

FooterLinkItem.propTypes = {
url: PropTypes.string,
title: PropTypes.string.isRequired,
target: PropTypes.oneOf(['_self', '_blank'])
title: PropTypes.string,
target: PropTypes.oneOf(['_self', '_blank']),
}

export default footerList(FooterLinkItem)
2 changes: 1 addition & 1 deletion react/components/FooterLinksMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class FooterLinksMatrix extends Component {
links: PropTypes.arrayOf(
PropTypes.shape({
/** Link section title */
title: PropTypes.string.isRequired,
title: PropTypes.string,
/** Link section links */
links: objectLikeLinkArray,
})
Expand Down
5 changes: 3 additions & 2 deletions react/components/FooterPaymentFormMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class FooterPaymentFormMatrix extends Component {
paymentForms: PropTypes.arrayOf(
PropTypes.shape({
/** Payment form title */
title: PropTypes.string.isRequired,
title: PropTypes.string,
/** Payment types */
paymentTypes: PropTypes.arrayOf(PropTypes.string.isRequired),
})
Expand All @@ -29,7 +29,8 @@ export default class FooterPaymentFormMatrix extends Component {
{paymentForms.map((paymentFormsItem, index) => (
<div
key={`payment-container-${index}`}
className={footer.paymentMatrixItem}>
className={footer.paymentMatrixItem}
>
<FooterPaymentFormList
horizontal
titleId={paymentFormsItem.title}
Expand Down
34 changes: 22 additions & 12 deletions react/components/footerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export default WrappedComponent => {
}

formatMessage(id) {
return this.props.intl.messages[id] && this.props.intl.formatMessage({ id }) || id
return (
(this.props.intl.messages[id] &&
this.props.intl.formatMessage({ id })) ||
id
)
}

render() {
Expand All @@ -44,27 +48,33 @@ export default WrappedComponent => {
if (!list || list.length === 0) return null

const titleClasses = classNames(`${footer.listTitle} t-small ma0 db`, {
'ttu': !titleCapitals,
ttu: !titleCapitals,
})

const listContainerClasses = classNames(`${footer.listContainer} pl0 w-100 mt0-ns`, {
[`${footer.listContainerRightAligned} ml-auto-m`]: alignRight,
[`${footer.listContainerHorizontal} w-auto-m`]: horizontal,
})
const listContainerClasses = classNames(
`${footer.listContainer} pl0 w-100 mt0-ns`,
{
[`${footer.listContainerRightAligned} ml-auto-m`]: alignRight,
[`${footer.listContainerHorizontal} w-auto-m`]: horizontal,
}
)

const listClasses = classNames(`${footer.list} list flex flex-column flex-wrap pa0 mb0 mt3`, {
[`${footer.listHorizontal} flex-row flex-wrap`]: horizontal,
})
const listClasses = classNames(
`${footer.list} list flex flex-column flex-wrap pa0 mb0 mt3`,
{
[`${footer.listHorizontal} flex-row flex-wrap`]: horizontal,
}
)

const listItemClasses = classNames(`${footer.listItem} mr0 mr3`, {
[`${footer.listItemHorizontal}`]: horizontal,
})

return (
<div className={listContainerClasses}>
<span className={titleClasses}>
{this.formatMessage(titleId)}
</span>
{titleId && (
<span className={titleClasses}>{this.formatMessage(titleId)}</span>
)}
<ul className={listClasses}>
{list.map((item, index) => (
<li key={index} className={listItemClasses}>
Expand Down
4 changes: 2 additions & 2 deletions react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class Footer extends Component {
sectionLinks: PropTypes.arrayOf(
PropTypes.shape({
/** Link section title */
title: PropTypes.string.isRequired,
title: PropTypes.string,
/** Link section links */
links: objectLikeLinkArray,
})
Expand All @@ -37,7 +37,7 @@ export default class Footer extends Component {
paymentForms: PropTypes.arrayOf(
PropTypes.shape({
/** Payment Form title */
title: PropTypes.string.isRequired,
title: PropTypes.string,
/** Payment Types */
paymentTypes: PropTypes.arrayOf(PropTypes.string),
})
Expand Down

0 comments on commit dc5498d

Please sign in to comment.