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

Stampy redesign article action buttons #394

Merged
merged 6 commits into from
Feb 14, 2024

Conversation

buddy-web3
Copy link
Member

No description provided.

@mruwnik
Copy link
Collaborator

mruwnik commented Feb 13, 2024

run npm run lint:fix

const actionIds = {helpful: false, unhelpful: false}

const loadActionTaken = () => {
forEach(actionIds, (value, key) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Object.entries(actionIds).forEach((value, key) => {
 (...)
})

No need to invoke extra dependancies

return
}
try {
forEach(actionIds, (value, key) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are you always setting all actions, rather than just the current action?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because they change values.. an article cannot be helpful and unhelpful simultaneously.

Copy link
Collaborator

Choose a reason for hiding this comment

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

why not? It absolutely can :D

} catch (e) {}
}

loadActionTaken()
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will be run each render - it should be in a useEffect

@@ -36,6 +36,7 @@
background: var(--colors-white, #fff);
}

.secondary.focused,
.secondary:hover {
border: 1px solid var(--colors-teal-200, #a6d9d7) !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

it shouldn't change the border - it should change the actual icon. So:

  • normal - grey icon
  • already clicked - teal icon

This should be possible by setting classes on the actual icon. The old icons hide the coloured SVG paths when they have the focused class

<ThumbUpIcon />
<span className="teal-500">Yes</span>
</Button>
<Button className="secondary" action={() => alert('Dislike')}>
<Button
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just do

import {Action, ActionType} from '~/routes/questions.actions'
(...)
<CompositeButton>
    <Action pageid={pageid} showText={false} actionType={ActionType.LIKE} />
    <Action pageid={pageid} showText={false} actionType={ActionType.DISLIKE} />
</CompositeButton>

with the appropriate styling/component updates?

Copy link
Member Author

Choose a reason for hiding this comment

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

There were mentions of backwards compatibility. "The appropriate styling" would make it unfit on the old domain.

Copy link
Collaborator

Choose a reason for hiding this comment

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

that's fine. It can live on a separate branch, or even be disabled there

<ThumbDownIcon />
<span className="teal-500">No</span>
</Button>
<CompositeButton style={{display: 'flex'}}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't do inline styles. There is a class for this, so just do className="flex"

style?: CSSProperties
}
export const CompositeButton = ({children, style}: CompositeButtonProps) => (
<div className="composite-button" style={style}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

yup; classes, not inline styles

</button>
<Button className={'secondary'} action={() => alert('helpful')}>
<Icon className={className} />
<span className="teal-500"> {showText && title}</span>
Copy link
Collaborator

Choose a reason for hiding this comment

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

{showText && (<span className="teal-500"> {title}</span>)}

Copy link
Contributor

@melissasamworth melissasamworth left a comment

Choose a reason for hiding this comment

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

This is mostly not CSS stuff. The CSS stuff I did see looked fine in that it followed the "rules" I made. Not sure I will agree 100% with the styling but that is my problem, will change it later if I really want to!

@mruwnik mruwnik force-pushed the stampy-redesign-articleActionButtons branch from 44619b0 to 43b1f1a Compare February 14, 2024 21:26
@mruwnik mruwnik force-pushed the stampy-redesign-articleActionButtons branch from 43b1f1a to 381ec2e Compare February 14, 2024 21:49
@mruwnik mruwnik merged commit 1fbe8d2 into stampy-redesign Feb 14, 2024
1 check passed
@mruwnik mruwnik deleted the stampy-redesign-articleActionButtons branch February 14, 2024 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants