-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c7bd53
commit 36ff084
Showing
11 changed files
with
299 additions
and
12 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
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
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 |
---|---|---|
|
@@ -41,6 +41,7 @@ type ctxKey int | |
const ( | ||
ctxKeyCSRF ctxKey = iota | ||
ctxKeyUser | ||
ctxKeyAccount | ||
) | ||
|
||
var setupOnce sync.Once | ||
|
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
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,37 @@ | ||
package views | ||
|
||
import "fmt" | ||
|
||
type ImageAttrs struct { | ||
URL string | ||
Classes templ.Attributes | ||
Width int | ||
Height int | ||
Units string | ||
Extra templ.Attributes | ||
} | ||
|
||
func (v ImageAttrs) units() string { | ||
if v.Units != "" { | ||
return v.Units | ||
} | ||
return "px" | ||
} | ||
|
||
func (v ImageAttrs) width() string { | ||
return fmt.Sprintf("%d%s", v.Width, v.units()) | ||
} | ||
|
||
func (v ImageAttrs) height() string { | ||
return fmt.Sprintf("%d%s", v.Height, v.units()) | ||
} | ||
|
||
templ Image(attrs ImageAttrs) { | ||
<img | ||
src={ attrs.URL } | ||
class={ attrs.Classes } | ||
width={ attrs.width() } | ||
height={ attrs.height() } | ||
{ attrs.Extra... } | ||
/> | ||
} |
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
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
Oops, something went wrong.