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

Fixing back arrow alignment/display logic [FTX Widget] #8947

Merged
merged 1 commit into from
Jun 9, 2021
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
5 changes: 2 additions & 3 deletions components/brave_new_tab_ui/widgets/ftx/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@ class FTX extends React.PureComponent<Props, State> {
}

renderTitle () {
const selectedAsset = this.props.ftx.assetDetail?.currencyName
const { showContent, widgetTitle } = this.props
// Only show back arrow to go back to opt-in view
const shouldShowBackArrow = !selectedAsset &&
this.props.ftx.currentView !== ViewType.OptIn &&
const shouldShowBackArrow = showContent &&
this.props.ftx.currentView === ViewType.Markets &&
!this.props.ftx.isConnected

return (
Expand Down
2 changes: 1 addition & 1 deletion components/brave_new_tab_ui/widgets/shared/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export const ListItem = styled('li')<StyleProps>`
export const BackArrow = styled('div')<StyleProps>`
width: 20px;
cursor: pointer;
margin-left: ${p => p.marketView ? 60 : 0}px;
margin-left: ${p => p.marketView ? 137 : 0}px;
Copy link
Contributor Author

@ryanml ryanml May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the only place this shared style is used is within the FTX widget. If this were to be a general style for the backarrow as it appears in only the header across widgets, styles may look something like this:

width: 20px;
cursor: pointer;
position: absolute;
right: 40px;

Given that this is also used in the asset detail view, to cover that use case as well, it may be best to nix all css rules besides width and cursor, and just put the burden of positioning on containers fitting the use case

`

export const ActionButton = styled('button')<StyleProps>`
Expand Down