-
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
Ticket #598 updated #639
Ticket #598 updated #639
Conversation
hint?: string | ||
children?: ReactNode | ReactNode[] |
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.
keep the children. This allows extra components to be provided
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 right, I added it back
app/routes/questions.actions.tsx
Outdated
hint?: string | ||
children?: ReactNode | ReactNode[] | ||
dissabled?: boolean |
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.
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.
fixed
@@ -0,0 +1,15 @@ | |||
.button-secondary .tool-tip { |
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 the whole point of tailwind to avoid having extra css?
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.
Tailwind does have some limitations. i.e. it is difficult to use selectors to control the styling of child elements.
app/components/Feedback/index.tsx
Outdated
return () => clearInterval(timeout) | ||
}, [showFeedback]) | ||
if (showThanks && thanksRef.current) { | ||
thanksRef.current.style.opacity = '1' |
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 classes for css. Or contitional rendering if you want to use js. Don't mix the two - there lies madness
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 this way, rather than the previous approach?
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 right on both accounts. I've updated the code
app/components/Feedback/index.tsx
Outdated
<Action | ||
pageid={pageid} | ||
showText={!!labels} | ||
actionType={ActionType.HELPFUL} | ||
active={vote === 'helpful'} | ||
dissabled={!!vote} |
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.
typo
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.
yup
app/components/Feedback/index.tsx
Outdated
const [showFeedbackForm, setShowFeedbackForm] = useState(false) | ||
const [vote, setVote]: any = useState(undefined) |
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 means that each time the page gets refreshed, the user can vote for the article again. The previous solution would rememeber whether an article was liked or not between refreshes
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.
very good point. I've updated the code, but note that I had to pass a setVoted function to the child Action components so that the feedback knew to set the other Action disabled. Its the best I could do. Also the handler function for voting in the questions.actions file is throwing an error, and thus the feedback button is returning to its null state after you press it.
I've incorporated all of your feedback except the check is failing for absolutely now reason. A prettier error even though I have run prettier. Oh well, I'm going to sleep |
Ok, no more tailwind, should be ready to merge 🤞 |
app/components/Article/article.css
Outdated
article .footer-comtainer { | ||
display: flex; | ||
align-items: center; | ||
margin-top: var(--spacing-56); | ||
margin-bottom: var(--spacing-24); | ||
gap: 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.
try to avoid raw pixel values. In root.css
there's a bunch of available variables that should be used for sizing and coiours. You use them as var(<var name)
, like in the previous lines. So in this case it'd be gap: var(--spacing-16);
. This is important both for consistency (as it's easier to change everything at once), but also because the mobile version often has subtle differences in spacing which should be reflected by 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.
Agreed
app/components/Feedback/feedback.css
Outdated
} | ||
|
||
/* Comment to Nemo when he reviews: why didn't you just do this the way you did the settings buttons? */ | ||
.select-option { | ||
height: var(--spacing-48); | ||
padding: var(--spacing-8) var(--spacing-16); | ||
border-radius: 6px; |
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 a var
here. Or consider adding the rounded
class to whatever is using 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.
yes I've changed it. The only reason I used the 6px is because that's what the figma said, but the var for --border-radius is 4px. I totally get the value of only needing to change one variable though so yeah.
app/components/Feedback/feedback.css
Outdated
|
||
.submit { | ||
height: var(--spacing-48); | ||
border-radius: 6px; |
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.
ditto
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.
There's actually a variable for border radius so use that var!
@@ -28,7 +54,6 @@ | |||
padding: var(--spacing-12); | |||
margin: var(--spacing-40) 0; | |||
box-sizing: content-box; | |||
background: pink; |
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.
hmm. interesting...
|
||
{showFeedback && <div className="thanks">Thanks for your feedback!</div>} | ||
<p className={'thanks ' + (showThanks ? 'show' : 'hide')}>Thank you for your feedback!</p> |
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.
out of curiosity, why are you doing it this way?
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.
because I wanted a css fade in/out transition which can't be done easily with conditional rendering to my knowledge. (in svelte you can tho 🙂)
app/components/Feedback/index.tsx
Outdated
|
||
{showFeedbackForm && ( | ||
<FeedbackForm | ||
onSubmit={onSubmit} | ||
onSubmit={(att) => { |
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 name this something more intuitive?
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.
Too true
@@ -160,6 +160,9 @@ h2 { | |||
letter-spacing: -0.14px; | |||
} | |||
|
|||
.leading-0 { | |||
line-height: 0 !important; |
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.
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.
When I was trying to style the button, It kept putting this annoying space below it. After some testing, I discovered it was a line-height issue. I've added this to the root incase there are other circumstances where there is a line-height problem.
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.
Fine with me
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.
Except sometimes the button actually goes to two lines. In which case this would end up looking really weird and bad obviously.
app/routes/questions.actions.tsx
Outdated
@@ -173,13 +184,9 @@ export const Action = ({ | |||
<input type="hidden" name="incBy" value={actionTaken ? -1 : 1} /> | |||
<input type="hidden" name="stateString" value={stateString} /> | |||
{children} | |||
<Button className={className}> | |||
<ButtonSecondary disabled={disabled} active={actionTaken} tooltip={hint}> |
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 is also just a normal button with a custom tooltip
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.
yup
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 can you check the css bits? The code seems fine
app/components/Button/button.css
Outdated
} | ||
|
||
.active { | ||
background-color: #edfaf9; |
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 should also be vars and use the colours in root.css
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 right
@@ -20,6 +20,15 @@ | |||
letter-spacing: -0.16px; | |||
} | |||
|
|||
.button-secondary { |
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 does this differ from the .secondary
class below? That is conceptually what's the difference?
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.
The second version of the button, as represented in the figma, is significantly stylistically different, mainly as a result of the difference in hover states (the main button shows and outline, and the second shows a background). This also effects how sibling buttons are grouped. The .secondary
class is a slight difference to the main button version, and the .button-secondary
class is a second version of the button.
@@ -160,6 +160,9 @@ h2 { | |||
letter-spacing: -0.14px; | |||
} | |||
|
|||
.leading-0 { | |||
line-height: 0 !important; |
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.
Fine with me
@@ -160,6 +160,9 @@ h2 { | |||
letter-spacing: -0.14px; | |||
} | |||
|
|||
.leading-0 { | |||
line-height: 0 !important; |
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.
Except sometimes the button actually goes to two lines. In which case this would end up looking really weird and bad obviously.
app/components/Feedback/feedback.css
Outdated
|
||
.submit { | ||
height: var(--spacing-48); | ||
border-radius: 6px; |
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.
There's actually a variable for border radius so use that var!
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.
testing review
Unlike the previous pr for this ticket, this one uses the
Action
component. I've created aButtonSecondary
component as a smaller alternative to theButton
component with slightly different styling as to match the Figma.tailwindcss
was added to improve the styling experienceNote: All 3 imports in the root.css file are needed for tailwind to work correctly. Also turns out the reference problems were happening cus I was using pnpm.