-
Notifications
You must be signed in to change notification settings - Fork 0
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
add styling to form inputs #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<link rel="stylesheet" href="/css/site.css"> | ||
<link rel="stylesheet" href="/css/main.css"> | ||
</head> | ||
<body> | ||
<body class="bg-gray-800 text-gray-100"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set background to gray-800 |
||
<div id="app">It seems the Fulcro app has not been loaded yet. Verify that shadow-cljs has finished building and reload the page</div> | ||
<script src="/js/main/main.js"></script> | ||
</body> | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -22,36 +22,38 @@ | |||||
:ident (fn [] [:component/id :header]) | ||||||
:initial-state {}} | ||||||
(let [load-user (get props [df/marker-table :load-progress])] | ||||||
(div :.flex.justify-between.items-center | ||||||
(div :.text-zinc-800 "Should I Train?") | ||||||
(div :.flex.justify-between.items-center.my-4 | ||||||
(div :.text-grey-100 "Should I Train?") | ||||||
(when-not load-user | ||||||
(div :.flex.flex-end | ||||||
(when (:user/authenticated? user) (div :.flex | ||||||
(p :.mr-2 (str "Hello " (or (:user/name user) "from the ui/Root component") "!")) | ||||||
(button {:onClick #(on-signout)} "Sign out"))) | ||||||
(when (not (:user/authenticated? user)) (button {:onClick #(github-signin)} "Sign in with GitHub"))))))) | ||||||
(p :.mr-2.text-grey-100 (str "Hello " (or (:user/name user) "from the ui/Root component") "!")) | ||||||
(button :.text-grey-100 {:onClick #(on-signout)} "Sign out"))) | ||||||
(when (not (:user/authenticated? user)) (button :.text-grey-100 {:onClick #(github-signin)} "Sign in with GitHub"))))))) | ||||||
|
||||||
(def ui-header (comp/factory Header)) | ||||||
|
||||||
(defn field [{:keys [label valid? error-message input-class id] :as props}] | ||||||
(let [input-props (-> props | ||||||
(dissoc :label :valid? :error-message :input-class :options))] | ||||||
(div | ||||||
(dom/label {:htmlFor label} label) | ||||||
(dom/label :.relative.block.bg-white.border.rounded-lg.shadow-sm.px-6.py-4.cursor-pointer.sm:flex.sm:justify-between.focus:outline-none.text-gray-700 {:htmlFor label} label) | ||||||
(input-class input-props) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you have to add |
||||||
(dom/div {:classes [(when valid? "hidden")]} | ||||||
error-message)))) | ||||||
|
||||||
(defsc Question [this {:question/keys [id label options]}] | ||||||
(defsc Question [this {:question/keys [id label byline options]}] | ||||||
{:query [:question/id | ||||||
:question/label | ||||||
:question/byline | ||||||
:ui/selected | ||||||
{:question/options [:option/label | ||||||
:option/value]}] | ||||||
:ident (fn [] [:question/id id]) | ||||||
:initial-state {}} | ||||||
(div :.mb-4 | ||||||
(h2 :.text-lg label) | ||||||
(div :.mb-4.p-4.bg-gray-700.rounded.max-w-fit | ||||||
(h2 :.text-xl.text-gray-100 label) | ||||||
(p :.text-gray-300.mb-2.italic byline) | ||||||
Comment on lines
+48
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adds byline because some questions rely on it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hey look, you added fulcro code 😎 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably only want to show the byline when its available so we avoid empty tags
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahhh good call, that's real nice syntax |
||||||
(map (fn [o] | ||||||
(field {:input-class input | ||||||
:name id | ||||||
|
@@ -75,8 +77,8 @@ | |||||
(when id | ||||||
(div | ||||||
(div :.flex.items-center.gap-1.mb3 | ||||||
(h2 :.text-xl.text-zinc-800 label) | ||||||
(p :.text-gray-500 "v" version)) | ||||||
(h2 :.text-3xl.text-gray-100.mb-2 label) | ||||||
(p :.text-gray-100 "v" version)) | ||||||
(dom/form | ||||||
(map ui-question questions))))) | ||||||
|
||||||
|
@@ -89,7 +91,7 @@ | |||||
{:header (comp/get-query Header)} | ||||||
{:quiz (comp/get-query Quiz)}] | ||||||
:initial-state {:root/user {} :header {} :quiz {}}} | ||||||
(div :.container.mx-auto.text-zinc-800 | ||||||
(div :.container.mx-auto.text-gray-100 | ||||||
Comment on lines
-92
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was getting fancy with that zinc color lol There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do eventually want to customize the tailwind config with the color pallet I have in #4 but keeping it simple for now |
||||||
(ui-header (comp/computed (:header props) {:on-signout #(comp/transact! this [(mut/delete-root-user nil)]) :user user})) | ||||||
(when (:quiz props) | ||||||
(ui-quiz (:quiz props))))) |
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.
It's cool that this file updates based on the classes that are used. Nice overview of 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.
even though locally generated files probably shouldn't be committed huh?
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 i didnt add a gitignore for this.. probably want to remove it from github