-
Notifications
You must be signed in to change notification settings - Fork 920
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
Conversation
1286e11
to
c0606ab
Compare
@@ -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; |
There was a problem hiding this comment.
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
const shouldShowBackArrow = !selectedAsset && | ||
this.props.ftx.currentView !== ViewType.OptIn && | ||
!this.props.ftx.isConnected | ||
const shouldShowBackArrow = showContent && !selectedAsset && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, back arrow could be visible when current view is markets and in not connected state.
and I think back arrow would be helpful also when asset is selected like below.
With this user can go back to opt-in view easily. WDYT? @ryanml @petemill
const shouldShowBackArrow = showContent &&
this.props.ftx.currentView === ViewType.Markets &&
!this.props.ftx.isConnected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simonhong, makes sense to me! I've updated this with:
--- a/components/brave_new_tab_ui/widgets/ftx/components/index.tsx
+++ b/components/brave_new_tab_ui/widgets/ftx/components/index.tsx
@@ -119,10 +119,9 @@ 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 = showContent && !selectedAsset &&
+ const shouldShowBackArrow = showContent &&
this.props.ftx.currentView !== ViewType.OptIn
Though I omitted the check for !this.props.ftx.isConnected
, as I believe we still want it shown in the connected state as well. Let me know if that isn't the case, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, or it could be that we don't want it to show when connected because at that point, the user should be disconnecting the widget as opposed to backtracking to pre-optin via the back arrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've re-updated this with your suggested snippet 👍
c0606ab
to
be345c4
Compare
be345c4
to
3205b11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ 👍
CI run from #9054 has all green. |
Fixing back arrow alignment/display logic [FTX Widget]
Verification passed on
FTX.NTP.mov |
Fixes brave/brave-browser#15941
Fixes brave/brave-browser#15930
Initial state:

Opt-in state:

After viewing markets (corrected alignment):

After viewing markets and switching to another widget (no persistence):

cc: @simonhong
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Defined in issue