Design comparison
Solution retrospective
I had some trouble with importing fonts into Tailwind. My paths to the font files are relative and when I ctrl + click them it leads me to the file in VS Code. The import statements for the fonts in globals.css are as follows:
@layer base { @font-face { font-family: WorkSans; font-weight: 400; src: url('/public/static/fonts/WorkSans-VariableFont_wght.ttf') format("ttf"); } @font-face { font-family: WorkSans; font-weight: 400; font-style: italic; src: url('/public/static/fonts/WorkSans-Italic-VariableFont_wght.ttf') format("ttf"); } @font-face { font-family: WorkSans; font-weight: 600; src: url('/public/static/fonts/WorkSans-VariableFont_wght.ttf') format("ttf"); } @font-face { font-family: WorkSans; font-weight: 600; font-style: italic; src: url('/public/static/fonts/WorkSans-Italic-VariableFont_wght.ttf') format("ttf"); } @font-face { font-family: WorkSans; font-weight: 700; src: url('/public/static/fonts/WorkSans-VariableFont_wght.ttf') format("ttf"); } @font-face { font-family: WorkSans; font-weight: 700; font-style: italic; src: url('/public/static/fonts/WorkSans-Italic-VariableFont_wght.ttf') format("ttf"); } }
Additionally, I found that Tailwind would only animate the accordion expanding if I explicitly defined the height of the container (h-0 to h-32 works, but h-0 to h-auto didn't). However, this means the container for the answer text will either be too small or too large depending on the screen size/amount of text. Is there a way to animate from h-0 to h-auto with Tailwind, or would the best solution be to animate the expanding and collapsing from scratch?
Community feedback
- @DeyanTopalovPosted 9 months ago
Hey Daniel,
Great work on the Challenge!
Regarding the trouble with the fonts, I recommend using next fonts as it is super easy and has much more benefits. Please find a a great YouTube video about Next fonts:
https://www.youtube.com/watch?v=L8_98i_bMMA
Regarding the animation from h-0 to h-auto, I have this implemented in my solution. Feel free to check it out (it's in the accordion.jsx component).
I hope you find this helpful, and keep the good work!
Marked as helpful1@GreenCitrus6Posted 9 months ago@DeyanTopalov Hi Deyan,
Thanks for the info on next fonts, I hadn't heard about it before but it got my local fonts working!
I also checked out the way you animated the FAQ answers and tried implementing something similar. Thank you for the feedback!
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord