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

Desktop News customize: unfollow removes follow #15499

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

petemill
Copy link
Member

@petemill petemill commented Oct 18, 2022

…and does not block ontent. follow / unfollow button text instead of heart icon

There will be a further follow-up to bring the exact design for the Follow / Unfollow button as well as channel icons. This can happen once Leo is available as a dependency.

Resolves brave/brave-browser#26090

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:

On issue

@petemill petemill self-assigned this Oct 18, 2022
@github-actions github-actions bot added the CI/storybook-url Deploy storybook and provide a unique URL for each build label Oct 18, 2022
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, I've left a few comments, and one question about how the hover/focus works for the cards (for me, when I click on them it focuses the button and moving the mouse off the card means the button stays visible until I click something else).

Approved because it's fairly minor, and definitely an improvement.

interface Props {
channelId: string
channelName: string
Copy link
Contributor

Choose a reason for hiding this comment

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

Good call, in my original iteration I thought channels might have a bit more info - nice to keep things simple.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah we still need to do translation and images and I thought I was going to do that in this PR, but this still makes sense I suppose for now.

@@ -15,7 +15,6 @@ interface Props {

const Container = styled(Flex)`
padding: 16px 0;
cursor: pointer;
Copy link
Contributor

Choose a reason for hiding this comment

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

Right, I should've removed this when I got rid of the channel pages

@@ -20,30 +26,27 @@ const Container = styled(Flex) <{ backgroundColor: string }>`
color: white;
position: relative;

:hover {
opacity: 0.8;
&[data-channel-card-is-followed=true] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, so I found this a bit weird. When I click on the button, it sets the :focus-within pseudo element so the button stays visible, even when I move the mouse outside. Then, when I click on something else, the button disappears.

Copy link
Member Author

Choose a reason for hiding this comment

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

ohh right

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed with :has(:focus-visible)


&[data-feed-card-is-followed=true] {
&:not(:hover, :focus-within) ${StyledFollowButton} {
opacity: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, it just feels a bit odd. Maybe this is what we want though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

const Name = styled.span`
font-size: 14px;
font-weight: 600;
`

const Pulse = keyframes`
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -132,7 +81,7 @@ export function DirectFeedCard (props: {
}) {
const [loading, setLoading] = useState(false)
return <Flex direction="column" gap={8}>
<Card backgroundColor={getCardColor(props.feedUrl)}>
<Card backgroundColor={getCardColor(props.feedUrl)} data-feed-card-is-followed={true}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to do this here? I think if the direct feed is followed we will hide it and just show a channel card instead

Copy link
Member Author

Choose a reason for hiding this comment

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

Only because it's using the same styles, hence the true instead of a variable

: <>
{HeartOutline} {getLocale('braveNewsFollowButtonNotFollowing')}
</>}
<Button {...rest} scale='tiny' isPrimary={!following}>
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 nice to see the button getting less loud

Copy link
Member Author

Choose a reason for hiding this comment

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

We can replace this with Leo's button when we have that available and maybe use that opportunity to clean all this up a bit and reduce repetition

<Flex align='center' gap={8}>
<FavIcon src={publisher.faviconUrl?.url} />
<Text>{publisher.publisherName}</Text>
</Flex>
<ToggleButton>
{subscribed ? Heart : HeartOutline}
<ToggleButton onClick={() => setFollowed(!followed)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth adding some padding/more gap to this button. It looks a bit odd with long names:
image

It might be because the Flex is collapsing the gap as things get too bit.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can tidy this up when we add channel images, Leo's button and fallback images

{subscribed ? Heart : HeartOutline}
<ToggleButton onClick={() => setFollowed(!followed)}>
{followed
? getLocale('braveNewsFollowButtonFollowing')
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this button is ever in a state where the source is not being followed? Non-followed sources are not shown in the list.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, I removed the other state

{subscribed ? Heart : HeartOutline}
<ToggleButton onClick={() => setSubscribed(!subscribed)}>
{subscribed
? getLocale('braveNewsFollowButtonFollowing')
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

…ontent. follow / unfollow button text instead of heart icon
@petemill petemill force-pushed the news-follow-button-unfollows branch from a1f246e to e13905d Compare October 18, 2022 03:20
@brave-builds
Copy link
Collaborator

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

@petemill petemill merged commit 09f5c90 into master Oct 18, 2022
@petemill petemill deleted the news-follow-button-unfollows branch October 18, 2022 06:21
@petemill petemill added this to the 1.46.x - Nightly milestone Oct 18, 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.

News: Unfollow button should remove follow and not block content
3 participants