Skip to content

Commit

Permalink
Merge pull request #27 from vtex-apps/feature/add-hide-backbutton@0.x
Browse files Browse the repository at this point in the history
Add hideBackButton prop @0.x
  • Loading branch information
bivillar authored Jun 24, 2020
2 parents 6610899 + 331f38d commit efe9d3a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- `hideBackButton` prop to ContentWrapper.

## [0.11.1] - 2020-06-15

### Fixed
Expand Down
23 changes: 13 additions & 10 deletions react/components/ContentWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,26 @@ class ContentWrapper extends Component {
history,
headerContent,
namespace,
hideBackButton = false,
} = this.props
const { shouldShowError } = this.state

const backButtonConfigs = {
linkLabel: backButton
? backButton.title
? backButton.title
: intl.formatMessage({ id: backButton.titleId })
: intl.formatMessage({ id: 'commons.back' }),
onLinkClick: () => history.push(backButton ? backButton.path : '/'),
}

return (
<section className="vtex-account__page w-100 w-80-m">
<header>
<PageHeader
title={title || intl.formatMessage({ id: titleId })}
linkLabel={
backButton
? backButton.title
? backButton.title
: intl.formatMessage({ id: backButton.titleId })
: intl.formatMessage({ id: 'commons.back' })
}
onLinkClick={() =>
history.push(backButton ? backButton.path : '/')
}>
{...(!hideBackButton && backButtonConfigs)}
>
{headerContent}
</PageHeader>
</header>
Expand Down Expand Up @@ -81,6 +83,7 @@ ContentWrapper.propTypes = {
path: PropTypes.string.isRequired,
}),
history: ReactRouterPropTypes.history.isRequired,
hideBackButton: PropTypes.bool,
headerContent: PropTypes.node,
}

Expand Down
2 changes: 1 addition & 1 deletion react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"eslint": "^5.16.0",
"eslint-config-vtex-react": "^4.0.0",
"prettier": "^1.17.0",
"typescript": "3.5.2"
"typescript": "3.8.3"
},
"version": "0.11.1"
}
8 changes: 4 additions & 4 deletions react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5183,10 +5183,10 @@ type-check@~0.3.2:
dependencies:
prelude-ls "~1.1.2"

typescript@3.5.2:
version "3.5.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.2.tgz#a09e1dc69bc9551cadf17dba10ee42cf55e5d56c"
integrity sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA==
typescript@3.8.3:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==

typescript@^3.3.3333:
version "3.5.3"
Expand Down

0 comments on commit efe9d3a

Please sign in to comment.