-
Notifications
You must be signed in to change notification settings - Fork 9
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
Stampy redesign 368 #412
Conversation
app/components/Button/button.css
Outdated
|
||
.action-feedback-text { | ||
display: none; | ||
position: absolute; |
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.
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! |
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.
@melissasamworth what will cause this to be hidden again? Should it disappear e.g. after 10s? Otherwise it will hang around and be annoying
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.
Yeah that works, disappears after 10s
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.
this also should probably go into the feedback form
} | ||
|
||
return ( | ||
<div className={className}> |
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.
why not just make this into a html form? A radio input + button should handle most of this
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.
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(' ')}> |
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.
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; |
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.
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; |
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.
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; |
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.
text-align: left; | ||
font-size: 16px; | ||
color: var(--colors-cool-grey-600); | ||
font-family: Poppins; |
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.
same as comment above :)
} | ||
.small { | ||
position: relative; | ||
letter-spacing: -0.01em; |
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.
same again heh
.small { | ||
position: relative; | ||
letter-spacing: -0.01em; | ||
line-height: 170%; |
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.
and here
.small3 { | ||
position: relative; | ||
letter-spacing: -0.01em; | ||
line-height: 170%; |
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.
++
position: relative; | ||
letter-spacing: -0.01em; | ||
line-height: 170%; | ||
font-weight: 600; |
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.
++
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
padding: 7px 17px; |
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.
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! |
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.
Yeah that works, disappears after 10s
app/components/Button/index.tsx
Outdated
} | ||
const Button = ({children, action, tooltip, icon, className}: ButtonProps) => { | ||
const Button = ({children, action, tooltip, icon, className, disabled = false}: ButtonProps) => { |
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.
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
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.
is it necessary for anything else besides the feedback form?
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.
not now, but it would be good to have it done for consistency
app/components/Button/button.css
Outdated
@@ -107,3 +107,34 @@ | |||
.tooltip:hover::after { | |||
display: block; | |||
} | |||
|
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.
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 |
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.
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( |
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.
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(() => { |
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.
why not move all this stuff into the feedback form component? It's only hidden, so the HTML elements will still be around
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.
for storybook functionality
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.
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
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.
You can add extra wrappers with decorators - check the ArticlesKeepGoing story
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 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! |
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.
this also should probably go into the feedback form
@@ -0,0 +1,44 @@ | |||
.feedback-header { | |||
color: var(--colors-black); |
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.
you can just use the black
class for this
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.
Code looks ok, @melissasamworth final approve is up to you if the CSS is acceptable
@@ -0,0 +1,63 @@ | |||
.feedback-container { | |||
width: 384px; |
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.
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; |
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.
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; |
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.
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; |
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'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; |
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 would say use the button component and apply the relevant class
height: 48px; | ||
border: 0; | ||
} | ||
.button:disabled, |
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.
these kinds of things should be added to the button component
No description provided.