feat: page content
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
package components
|
||||
|
||||
import "strings"
|
||||
import "fmt"
|
||||
import "git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/components/images"
|
||||
|
||||
templ ImageTile(src string) {
|
||||
<div class="grid grid-cols-1 grid-rows-1">
|
||||
<img
|
||||
src={ src }
|
||||
srcset={ makeSrcset(src) }
|
||||
srcset={ images.SourceSet(src) }
|
||||
fetchpriority="high"
|
||||
class="row-start-1 col-start-1 pointer-events-none w-full h-96 object-cover"
|
||||
/>
|
||||
@@ -16,16 +15,3 @@ templ ImageTile(src string) {
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
func makeSrcset(src string) string {
|
||||
sb := strings.Builder{}
|
||||
|
||||
for i := range 19 {
|
||||
sb.WriteString(fmt.Sprintf("%s?w=%d %dw, ", src, 100*(i+1), 50*(i+1)))
|
||||
}
|
||||
|
||||
i := 20
|
||||
sb.WriteString(fmt.Sprintf("%s?w=%d %dw", src, 100*(i+1), 50*(i+1)))
|
||||
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user