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 368 #412

Merged
merged 9 commits into from
Mar 6, 2024
Merged

Stampy redesign 368 #412

merged 9 commits into from
Mar 6, 2024

Conversation

buddy-web3
Copy link
Member

No description provided.

@Aprillion Aprillion removed their request for review February 16, 2024 10:47

.action-feedback-text {
display: none;
position: absolute;
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you do this with relative values? This will not work on smaller screens

onSuccess={() => setShowFeedbackForm(true)}
/>
<span className={['action-feedback-text', showFeedback ? 'show' : ''].join(' ')}>
Thanks for your feedback!
Copy link
Collaborator

Choose a reason for hiding this comment

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

@melissasamworth what will cause this to be hidden again? Should it disappear e.g. after 10s? Otherwise it will hang around and be annoying

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that works, disappears after 10s

Copy link
Collaborator

Choose a reason for hiding this comment

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

this also should probably go into the feedback form

}

return (
<div className={className}>
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 make this into a html form? A radio input + button should handle most of this

Copy link
Member Author

Choose a reason for hiding this comment

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

all other comments have been addressed. this one is slightly more css-nasty.

className={'feedback-text'}
placeholder={'Leave a comment (optional)'}
></textarea>
<div className={['submit-feedback', enabledSubmit ? 'enabled' : ''].join(' ')}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

use the Button component

border-radius: 6px;
background-color: #fff;
box-shadow: 0px 16px 40px rgba(175, 183, 194, 0.2);
border: 1px solid #dfe3e9;
Copy link
Contributor

Choose a reason for hiding this comment

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

could you reference the var?

border-radius: 6px;
background-color: #fff;
box-shadow: 0px 16px 40px rgba(175, 183, 194, 0.2);
border: 1px solid #dfe3e9;
Copy link
Contributor

Choose a reason for hiding this comment

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

here too

As a general rule, too, if we're repeating code a lot we should just create a one-off class for newroot.css like

.border {
border: 1px solid #dfe3e9;
}

position: relative;
height: 542px;
text-align: left;
font-size: 16px;
Copy link
Contributor

Choose a reason for hiding this comment

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

The idea was to make it so you never have to write a line of code related to anything type. Just look at what class I use in Figma and find that same class in newroot.css

image

text-align: left;
font-size: 16px;
color: var(--colors-cool-grey-600);
font-family: Poppins;
Copy link
Contributor

Choose a reason for hiding this comment

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

same as comment above :)

}
.small {
position: relative;
letter-spacing: -0.01em;
Copy link
Contributor

Choose a reason for hiding this comment

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

same again heh

.small {
position: relative;
letter-spacing: -0.01em;
line-height: 170%;
Copy link
Contributor

Choose a reason for hiding this comment

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

and here

.small3 {
position: relative;
letter-spacing: -0.01em;
line-height: 170%;
Copy link
Contributor

Choose a reason for hiding this comment

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

++

position: relative;
letter-spacing: -0.01em;
line-height: 170%;
font-weight: 600;
Copy link
Contributor

Choose a reason for hiding this comment

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

++

flex-direction: row;
align-items: center;
justify-content: center;
padding: 7px 17px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Always use a variable. If the padding in the file was 7px I meant for it to be 8px sorry! 17px would be 16px.

onSuccess={() => setShowFeedbackForm(true)}
/>
<span className={['action-feedback-text', showFeedback ? 'show' : ''].join(' ')}>
Thanks for your feedback!
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that works, disappears after 10s

}
const Button = ({children, action, tooltip, icon, className}: ButtonProps) => {
const Button = ({children, action, tooltip, icon, className, disabled = false}: ButtonProps) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

how would this work for link buttons? You can add a onClick={(e) => e.preventDefault()} or something, to disable it, but it might require a bit extra styling

Copy link
Member Author

Choose a reason for hiding this comment

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

is it necessary for anything else besides the feedback form?

Copy link
Collaborator

Choose a reason for hiding this comment

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

not now, but it would be good to have it done for consistency

@@ -107,3 +107,34 @@
.tooltip:hover::after {
display: block;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

could you move the feedback specific items to feedbackForm.css?

<span className={'feedback-header'}>What was the problem?</span>
{hasOptions
? feedbackOptions.map((option, index) => (
<div
Copy link
Collaborator

Choose a reason for hiding this comment

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

aren't these also buttons? So something like <Button className={option.selected ? 'secondary-alt bordered' : 'secondary'} action={() => selectFeedback(index)}>{option.text}</Button>

])
const [enabledSubmit, setEnabledSubmit] = React.useState(false)
const selectFeedback = (option: number) => {
setFeedbackOptions(
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 store the selected item? So:

const [selected, setSelected] = useState<string>()

const selectFeedback = (option: string) => {
    setSelected(option)
}
(...)
<div className={option.option === selected ? 'selected' : ''}
    onClick={() => selectFeedback(option.option)}>
  {option.text}
</div>

const date =
question.updatedAt &&
new Date(question.updatedAt).toLocaleDateString('en-GB', {
year: 'numeric',
month: 'short',
})

React.useEffect(() => {
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 move all this stuff into the feedback form component? It's only hidden, so the HTML elements will still be around

Copy link
Member Author

Choose a reason for hiding this comment

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

for storybook functionality

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 the wrong way round. Storybook, tests etc. shouldn't change how the actual code is structured. If something is hard to do without changes, then it's a hint that something is wrong, but the code should dictate storybook, not the other way round

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can add extra wrappers with decorators - check the ArticlesKeepGoing story

Copy link
Member Author

Choose a reason for hiding this comment

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

I've been looking into this but I don't believe it's a feasible option. The article makes it display when submitted, moving part of the logic to the Feedback component would just duplicate logic and code.

onSuccess={() => setShowFeedbackForm(true)}
/>
<span className={['action-feedback-text', showFeedback ? 'show' : ''].join(' ')}>
Thanks for your feedback!
Copy link
Collaborator

Choose a reason for hiding this comment

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

this also should probably go into the feedback form

@@ -0,0 +1,44 @@
.feedback-header {
color: var(--colors-black);
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can just use the black class for this

Copy link
Collaborator

@mruwnik mruwnik left a comment

Choose a reason for hiding this comment

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

Code looks ok, @melissasamworth final approve is up to you if the CSS is acceptable

@@ -0,0 +1,63 @@
.feedback-container {
width: 384px;
Copy link
Contributor

Choose a reason for hiding this comment

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

what is feedback container? We'll want to be added .col-* class to different elements instead of defining the width through writing more CSS. I imagine this might be one of those cases? :)

.feedback-form {
width: 100%;
position: relative;
text-align: left;
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't text-align left by default? If not we should define this in the body tag, so we don't have to define it again here

width: 100%;
position: relative;
text-align: left;
font-size: 16px;
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't want to ever write CSS related to typography, just reference whichever class was assigned to it in Figma!

.action-feedback-text {
display: none;
position: absolute;
left: 180px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm skeptical about how these kinds of things will convert to mobile but let's see what happens

display: block;
.button.full-width {
width: 100%;
height: 48px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would say use the button component and apply the relevant class

height: 48px;
border: 0;
}
.button:disabled,
Copy link
Contributor

Choose a reason for hiding this comment

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

these kinds of things should be added to the button component

@melissasamworth melissasamworth merged commit 3942184 into stampy-redesign Mar 6, 2024
1 check passed
@melissasamworth melissasamworth deleted the stampy-redesign-368 branch March 6, 2024 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants