Learning-HTMX/12-order-summary-component-...
efim fe8b54346a docs: adding license to deployable projects 2023-07-22 06:04:42 +00:00
..
design feat(12): adding assets of the exercise 2023-06-28 08:35:31 +00:00
project feat(12): nix installation of exercise 2023-06-28 12:51:03 +00:00
public/images feat(12): adding assets of the exercise 2023-06-28 08:35:31 +00:00
src docs: adding license to deployable projects 2023-07-22 06:04:42 +00:00
.gitignore feat(12): nix installation of exercise 2023-06-28 12:51:03 +00:00
.project init(12): new sbt project: static price component 2023-06-28 06:11:07 +00:00
.scalafmt.conf init(12): new sbt project: static price component 2023-06-28 06:11:07 +00:00
README.org docs(12): lessons learned and docker deploy 2023-07-05 06:47:10 +00:00
build.sbt feat(root): attempt to create combined project 2023-07-03 07:34:41 +00:00
default.nix docs(12): lessons learned and docker deploy 2023-07-05 06:47:10 +00:00
screenshot-desktop.png docs(12): lessons learned and docker deploy 2023-07-05 06:47:10 +00:00
screenshot-mobile.png docs(12): lessons learned and docker deploy 2023-07-05 06:47:10 +00:00
screenshot.png docs: saving some things about dev process 2023-06-28 12:28:59 +00:00
style-guide.md feat(12): adding assets of the exercise 2023-06-28 08:35:31 +00:00
tailwind.config.js feat(12): active states styled 2023-06-28 12:10:25 +00:00

README.org

Frontend Mentor - Order summary card solution

This is a solution to the Order summary card challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Overview

The challenge

Users should be able to:

  • See hover states for interactive elements

Screenshot

/efim/Learning-HTMX/media/commit/843c71946f30214b1155ef56bcd8d67bfa7a33d2/12-order-summary-component-thymeleaf/screenshot-desktop.png /efim/Learning-HTMX/media/commit/843c71946f30214b1155ef56bcd8d67bfa7a33d2/12-order-summary-component-thymeleaf/screenshot-mobile.png

My process

Built with

  • Semantic HTML5 markup
  • Tailwincss
  • Mobile-first workflow
  • SSR in Scala & Cask webserver
  • Thymeleaf templates
running during development

installing "sbt-revolver":

addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0")

then `~reStart -p 49012`

otherwise ~ in front of sbt command reruns it only if it finished execution.

What I learned

placing Thymeleaf templates

if they are in src/main/resources - they should be available on class path. and search should be relative to the resources, i.e putting templates into dir "templates" then

val templateResolver = new ClassLoaderTemplateResolver()
templateResolver.setPrefix("templates/");
templateResolver.setSuffix(".html")
val result = templateEngine.process("index", context)

will look for file in "src/main/resources/templates/index.html" to treat as a template

to reload web server during development - sbt plugin "sbt-revolver"
with these html templates I can start learning and using Emmet mode in Emacs
Importing Thymeleaf template

There are other methods to include templates like th:replace and th:include, which have slightly different behaviours. th:insert keeps the host tag (the div in your case), th:replace replaces the whole host tag with the fragment, and th:include replaces the inner content of the host tag with the fragment.

So i can actually have the "Order Summary" as reusable part.

getting responsive background image with Tailwincss
    <div
      class="bg-[url('../public/images/pattern-background-mobile.svg')] fixed h-screen w-screen bg-no-repeat bg-contain md:bg-[url('../public/images/pattern-background-desktop.svg')]"
    ></div>

Continued development

This was first exercise I've done with Thymeleaf templates.

Next is using fragments with some dynamic content and styling. Then attempting to include htmx fueled reactivity.

Acknowledgments

Lots of gratitude to Thymeleaf templates, they seem to be very advandced and thoughtfully designed