-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
feat: Improve CreateComment and CreateReply components (ONEARMY#3656)… #4020
feat: Improve CreateComment and CreateReply components (ONEARMY#3656)… #4020
Conversation
I would like to add, that I haven't added new Unit Tests, since this is also just a visual change. |
Thanks @johannes-ross! |
I agree and also think a bit hard is understated. The values I used for the breakpoints are all coming from testing. I don't even understand why they work. Definition of magic numbers. I've tried to use a CSS only approach. I used the following sources and variations and combinations of it:
The Problem that I always encountered was flickering when getting near the line end. Here is what I've found:
So using pure CSS doesn't work, because we have to change the width of the text area when we reach the first character count. A simple Idea to get rid of all the complex JS and CSS combination would be to just get rid of this: and always have the character count on the bottom line, like in the second one. I've just noticed, I missed that when the Input is empty, the count shouldn't be displayed. I have to fix that, but I'm going to wait until we've discussed this and found a useful solution. Our greatest hope is, that the future will fix it: |
Wow, such a cool contribution @johannes-ross ! Thank you for all the effort, I see now the problem of complexity of that trick and maintenance which I didn't foresee from the perspective of a designer. I agree that we can simplify a bit. The point with the moving character count was so that the component has only the necessary height in the beginning when it's not active, in case that the user sees several of them at once, so that they don't occupy a big portion of the screen. This point could be achieved also simply like this: The char count is not shown when the textarea is not active, but once the user clicks into the text area (or types the first character, or whatever makes sense to code) the char count shows below. What do you think? Would that help? |
Oh and one more thing... Would it be possible to set the font-size of the text-area to be equal to the font-size of the comment? Side note: In the near future it might happen that for mobile, the comments' font size might be lower (14px) than on desktop. But there is no decision yet, so I don't know if it's good to hard-code it. |
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.
Thanks so much @johannes-ross for such a thorough dive into this!
So yes, definitely agree with @mariojsnunes about the maintenance issue.
How's the below for a tighter technical scope?
- Go as far as can be achieved with css (i.e. if functionality isn't possible without custom js, that it's not possible.)
- There's a readability challenge due to how much styling has to be changed between mobile/desktop so I think it's OK to use the responsive display none appoach at a slightly higher level to have seperate components for mobile/desktop like how it's done on
src/pages/Maps/Content/MapView/MapWithList.tsx
. Then - As it's available on chrome, I'm very happy for field-sizing to be tried (with a code comment).
A more detailed point...
- I think the use of
Grid
can be avoided using 2 above. Then for desktop it's just the badge and button using the space they need and the textbox flexing in the middle and for mobile the icon (which should be done using oa-components'Button
with theshowIconOnly
prop
It's funny how much back and forth can happen on this type of relatively small issue so if there's still changes needed after your next draft maybe we can pair to finish it off?
@all-contributors add @johannes-ross for code |
I've put up a pull request to add @johannes-ross! 🎉 |
Hey, just an update. I'm currently really busy and won't be abled to work on this till tomorrow. |
I've tried to use as much CSS as possible. The only thing I've used JS for is the focus. I can remove it, because it adds 2 new Renders, but I don't think it's actually that significant. |
onearmy-community-platform
|
Project |
onearmy-community-platform
|
Branch Review |
pull/4020
|
Run status |
|
Run duration | 04m 56s |
Commit |
|
Committer | Ben Furber |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
2
|
|
0
|
|
0
|
|
71
|
View all changes introduced in this branch ↗︎ |
67e82a4
to
a398a40
Compare
a398a40
to
54ffc3c
Compare
54ffc3c
to
85bb60a
Compare
@mariojsnunes Looks like all the preview branches are failing as they need |
… Create CSS & JS logic for size change
… Use more CSS and less JS
… Fix failed Server-Tests
d9a8474
to
c00a058
Compare
Thanks @johannes-ross! Rather than ask you to do a bunch of minior clean-up that's more subjective so I thought I'd just do it. Merging in now. |
🎉 This PR is included in version 2.15.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Heyy, sorry for the bump again. I just noticed that the change is implemented across HowTo and Research modules, but not in the Questions module. Could we do a quick fix and implement it there as well? Thankssss, great job @johannes-ross once again! Works like a charm. :)) |
Hey, I've looked at the Question Code and I can't quickly find a reason, why it would behave the way you described. @dalibormrska I think we should open a new Ticket for further investigation. |
I'll take care of that |
… Create CSS & JS logic for size change
PR Checklist
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Site just breaks or doesn't look pretty when you try to comment on a mobile device.
When you type, the textarea never changes size. You can change it's size manually.
What is the new behavior?
Site now looks pretty when you try to comment on a mobile device or a different screensize.
When you type, the textarea now dynamicly changes it's size.
Does this PR introduce a breaking change?
Git Issues
Closes #3656