package bootstrap import "strconv" type IndexCourseCategoryItem struct { ID string Name string Description string ExampleThemes []string Count int } // courseItemCard is a card that renders a single course thematic item // that holds multiple learning types. It expected to have a basic description // and an amount of items. templ courseItemCard(item IndexCourseCategoryItem) {
{ item.Name }

{ item.Description }

if len(item.ExampleThemes) > 0 {

В данной категории вы можете найти курсы по темам:

}
Open { strconv.Itoa(item.Count) } items.
} templ courseCategory(items []IndexCourseCategoryItem) {
for _, item := range items {
@courseItemCard(item)
}
} type Pagination struct { Page int TotalPages int BaseURL string QueryParams string } func (p Pagination) pageURL(page int) string { url := p.BaseURL + "?page=" + strconv.Itoa(page) if p.QueryParams != "" { url += "&" + p.QueryParams } return url } templ pagination(p Pagination) { if p.Page > 0 && p.TotalPages > 0 { } } type MainPageParams struct { Breadcrumbs BreadcrumbsParams Categories []IndexCourseCategoryItem Pagination Pagination } templ MainPage(pageType PageKind, s stats, params MainPageParams) { @root(pageType, s) { @listCoursesSectionHeader(params.Breadcrumbs) @courseCategory(params.Categories) @pagination(params.Pagination) } }