Skip to content
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

Merged
merged 1 commit into from
Dec 23, 2021
Merged

add styling to form inputs #5

merged 1 commit into from
Dec 23, 2021

Conversation

zacjones93
Copy link
Collaborator

@zacjones93 zacjones93 commented Dec 22, 2021

First pass at styling inputs. Would like to progress to #4

I'd like to change how the radio groups are displayed but my limitation of the language is making it hard. Those radio buttons could be centered in their respective answer or removed entirely
Minimalist Fulcro Template

Comment on lines +482 to +487
.mb-2 {
margin-bottom: 0.5rem;
}
.mb-4 {
margin-bottom: 1rem;
}
Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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?

Copy link
Owner

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

@@ -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">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set background to gray-800


(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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This input-class is giving me trouble. Not sure how to style the radio button. Ideally it would move in the label or be hidden entirely

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to add appearance: none and then add all your custom properties. This looks like a good guide https://moderncss.dev/pure-css-custom-styled-radio-buttons/

Comment on lines +48 to +56
: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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds byline because some questions rely on it

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey look, you added fulcro code 😎

(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)
Copy link
Owner

Choose a reason for hiding this comment

The 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
(p :.text-gray-300.mb-2.italic byline)
(when byline (p :.text-gray-300.mb-2.italic byline))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh good call, that's real nice syntax

Comment on lines -92 to +94
(div :.container.mx-auto.text-zinc-800
(div :.container.mx-auto.text-gray-100
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting fancy with that zinc color lol

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

@theianjones theianjones merged commit cb9016e into master Dec 23, 2021
@theianjones theianjones deleted the zj/style-form-input branch December 23, 2021 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants