-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: start using props in components
- Loading branch information
Showing
16 changed files
with
776 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package components | ||
|
||
import "strconv" | ||
|
||
type DropdownProps struct { | ||
Route string | ||
Options []int | ||
Value string | ||
} | ||
|
||
templ Dropdown(props DropdownProps) { | ||
<select class="appearance-none border border-neutral-300 dark:border-neutral-700 rounded text-xs px-2 py-1 bg-transparent focus:outline-dashed focus:outline-offset-2 focus:outline-neutral-300 dark:focus:outline-neutral-700" hx-target="closest section" hx-get={ props.Route } name="year" value={ props.Value } hx-swap="outerHTML"> | ||
for _, option := range props.Options { | ||
<option | ||
value={ strconv.Itoa(option) } | ||
if props.Value == strconv.Itoa(option) { | ||
selected | ||
} | ||
>{ strconv.Itoa(option) }</option> | ||
} | ||
</select> | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.