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

Update "Sponsored Images" toggle UI #14986

Merged
merged 3 commits into from
Sep 20, 2022
Merged

Update "Sponsored Images" toggle UI #14986

merged 3 commits into from
Sep 20, 2022

Conversation

sangwoo108
Copy link
Contributor

@sangwoo108 sangwoo108 commented Sep 3, 2022

Rough requirements:

  • The toggle UI should be below background image options
  • The new toggle UI should contain descriptions about Sponsored Images
  • When Brave Rewards or Brave Ad are not enabled, a button should be visible
  • When a user toggles on the option and Reward & Ads are enabled, the description
    should notify the user that they're earning from it.
  • When clicking the "Rewards" button, "Reward tour" UI appears or "Brave Ads" option is enabled.

Light theme

스크린샷 2022-09-03 오후 8 51 24

Dark theme

스크린샷 2022-09-03 오후 8 51 47

Resolves brave/brave-browser#25197

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Manual: Described from PR description

@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label Sep 3, 2022
@sangwoo108 sangwoo108 force-pushed the sko/ntp-si branch 3 times, most recently from be67258 to d81cf9c Compare September 3, 2022 13:15
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Contributor

@fallaciousreasoning fallaciousreasoning left a comment

Choose a reason for hiding this comment

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

Mostly looks good, couple of comments about CSS variables

justify-content: space-between;
padding: 12px 14px;
border-radius: 10px;
background-color: ${p => isDarkTheme(p) ? css`#1E2029` : css`white`};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
background-color: ${p => isDarkTheme(p) ? css`#1E2029` : css`white`};
background-color: var(--background1);

should automatically handle light/dark mode (and you can remove isDarkTheme)

Copy link
Contributor

Choose a reason for hiding this comment

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

See brave/components/web-components/app.global.scss for the CSS variables we have. I think there's a convention for transforming the color name in Figma to the css variable name, but there are a bunch of missing colors in there sadly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

convention for transforming the color name in Figma to the css variable name

Great! Is there a doc for this part? I was wondering how we manage all these variable stuffs. Also this is my first time to use Figma, It'd be really nice to learn best practices.

Copy link
Contributor

@fallaciousreasoning fallaciousreasoning Sep 6, 2022

Choose a reason for hiding this comment

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

I haven't really used it much either 😆 I think in the new design system the Figma ==> CSS variable transformation is more straightforward. I often just search for the hex color in app.global.css or the last bit of the color name in figma but without leading 0s (ie. Light Theme/Text/text01 becomes --text1).

@petemill is probably the best person to ask about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Theme/Text/text01 becomes --text1).

Aha! that's the convention! thanks a lot :)

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@diracdeltas
Copy link
Member

probably @PrivacyMatters needs to take a look here to review the strings and overall opt-in UI

@PrivacyMatters
Copy link

@sangwoo108 It's important to use correct terminology. The images show the toggle set to ON and which makes it an opt-out (not an opt-in). If the toggle was off, and the user turned it ON, it would be opt-in.

The default chosen by Brave is that Sponsored Images are ON by default (so an opt-out), even when Brave Rewards have NOT been enabled by a user.

Has it been implemented differently in South Korea?

@sangwoo108 sangwoo108 closed this Sep 6, 2022
@sangwoo108 sangwoo108 reopened this Sep 6, 2022
@sangwoo108
Copy link
Contributor Author

sangwoo108 commented Sep 6, 2022

@sangwoo108 It's important to use correct terminology. The images show the toggle set to ON and which makes it an opt-out (not an opt-in). If the toggle was off, and the user turned it ON, it would be opt-in.

The default chosen by Brave is that Sponsored Images are ON by default (so an opt-out), even when Brave Rewards have NOT been enabled by a user.

Has it been implemented differently in South Korea?

Oh, my bad. There are no changes intended default state of sponsored image. I just update UI of the toggle UI.


updated pr description and commit message

@sangwoo108 sangwoo108 changed the title Update "Sponsored Images" opt-in UI Update "Sponsored Images" toggle UI Sep 6, 2022
@sangwoo108
Copy link
Contributor Author

cc. @rebron since strings are from spec.

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@PrivacyMatters
Copy link

@sangwoo108 is this is about providing users who do not have Rewards enabled with a notice that they can earn BAT by enabling it?

@sangwoo108
Copy link
Contributor Author

sangwoo108 commented Sep 7, 2022

@sangwoo108 is this is about providing users who do not have Rewards enabled with a notice that they can earn BAT by enabling it?

@PrivacyMatters Yes, I think so. This is part of brave/brave-browser#15252 and you can find the spec for this there. cc. @rebron

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@sangwoo108
Copy link
Contributor Author

Hi, @PrivacyMatters . Do you have anything else for me to address?

Rough requirements:
- The toggle UI should be below background image options
- The new toggle UI should contain descriptions about Sponsored Images
- When Brave Rewards or Brave Ad are not enabled, a button should be visible
- When a user opts in the option and Reward & Ads are enabled, the description
  should notify the user that they're earning from it.
- When clicking the "Rewards" button, "Reward tour" UI appears or "Brave Ads" option is enabled.
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@PrivacyMatters
Copy link

@sangwoo108 no more comment from me. It is only being presented to people with the SI default ON.

@sangwoo108
Copy link
Contributor Author

Thank you so much @PrivacyMatters !

@fallaciousreasoning Could you take another look please?

Copy link
Contributor

@fallaciousreasoning fallaciousreasoning left a comment

Choose a reason for hiding this comment

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

LGTM, sorry for the delay @sangwoo108

@sangwoo108
Copy link
Contributor Author

sangwoo108 commented Sep 20, 2022

LGTM, sorry for the delay @sangwoo108

No problem at all. You're one of the most responsive reviewers around me so that I count on 😎 Thanks for the review!


I checked reviewers checklist on behalf of you as it's blocking.

@sangwoo108 sangwoo108 merged commit 74da03e into master Sep 20, 2022
@sangwoo108 sangwoo108 deleted the sko/ntp-si branch September 20, 2022 00:13
@github-actions github-actions bot added this to the 1.45.x - Nightly milestone Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update "Sponsored Images" toggle UI
6 participants