skeleton-loader.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. package vuetify
  2. import (
  3. "context"
  4. "fmt"
  5. h "github.com/theplant/htmlgo"
  6. )
  7. type VSkeletonLoaderBuilder struct {
  8. tag *h.HTMLTagBuilder
  9. }
  10. func VSkeletonLoader(children ...h.HTMLComponent) (r *VSkeletonLoaderBuilder) {
  11. r = &VSkeletonLoaderBuilder{
  12. tag: h.Tag("v-skeleton-loader").Children(children...),
  13. }
  14. return
  15. }
  16. func (b *VSkeletonLoaderBuilder) Boilerplate(v bool) (r *VSkeletonLoaderBuilder) {
  17. b.tag.Attr(":boilerplate", fmt.Sprint(v))
  18. return b
  19. }
  20. func (b *VSkeletonLoaderBuilder) Dark(v bool) (r *VSkeletonLoaderBuilder) {
  21. b.tag.Attr(":dark", fmt.Sprint(v))
  22. return b
  23. }
  24. func (b *VSkeletonLoaderBuilder) Elevation(v int) (r *VSkeletonLoaderBuilder) {
  25. b.tag.Attr(":elevation", fmt.Sprint(v))
  26. return b
  27. }
  28. func (b *VSkeletonLoaderBuilder) Height(v int) (r *VSkeletonLoaderBuilder) {
  29. b.tag.Attr(":height", fmt.Sprint(v))
  30. return b
  31. }
  32. func (b *VSkeletonLoaderBuilder) Light(v bool) (r *VSkeletonLoaderBuilder) {
  33. b.tag.Attr(":light", fmt.Sprint(v))
  34. return b
  35. }
  36. func (b *VSkeletonLoaderBuilder) Loading(v bool) (r *VSkeletonLoaderBuilder) {
  37. b.tag.Attr(":loading", fmt.Sprint(v))
  38. return b
  39. }
  40. func (b *VSkeletonLoaderBuilder) MaxHeight(v int) (r *VSkeletonLoaderBuilder) {
  41. b.tag.Attr(":max-height", fmt.Sprint(v))
  42. return b
  43. }
  44. func (b *VSkeletonLoaderBuilder) MaxWidth(v int) (r *VSkeletonLoaderBuilder) {
  45. b.tag.Attr(":max-width", fmt.Sprint(v))
  46. return b
  47. }
  48. func (b *VSkeletonLoaderBuilder) MinHeight(v int) (r *VSkeletonLoaderBuilder) {
  49. b.tag.Attr(":min-height", fmt.Sprint(v))
  50. return b
  51. }
  52. func (b *VSkeletonLoaderBuilder) MinWidth(v int) (r *VSkeletonLoaderBuilder) {
  53. b.tag.Attr(":min-width", fmt.Sprint(v))
  54. return b
  55. }
  56. func (b *VSkeletonLoaderBuilder) Tile(v bool) (r *VSkeletonLoaderBuilder) {
  57. b.tag.Attr(":tile", fmt.Sprint(v))
  58. return b
  59. }
  60. func (b *VSkeletonLoaderBuilder) Transition(v string) (r *VSkeletonLoaderBuilder) {
  61. b.tag.Attr("transition", v)
  62. return b
  63. }
  64. func (b *VSkeletonLoaderBuilder) Type(v string) (r *VSkeletonLoaderBuilder) {
  65. b.tag.Attr("type", v)
  66. return b
  67. }
  68. func (b *VSkeletonLoaderBuilder) Types(v interface{}) (r *VSkeletonLoaderBuilder) {
  69. b.tag.Attr(":types", h.JSONString(v))
  70. return b
  71. }
  72. func (b *VSkeletonLoaderBuilder) Width(v int) (r *VSkeletonLoaderBuilder) {
  73. b.tag.Attr(":width", fmt.Sprint(v))
  74. return b
  75. }
  76. func (b *VSkeletonLoaderBuilder) SetAttr(k string, v interface{}) {
  77. b.tag.SetAttr(k, v)
  78. }
  79. func (b *VSkeletonLoaderBuilder) Attr(vs ...interface{}) (r *VSkeletonLoaderBuilder) {
  80. b.tag.Attr(vs...)
  81. return b
  82. }
  83. func (b *VSkeletonLoaderBuilder) Children(children ...h.HTMLComponent) (r *VSkeletonLoaderBuilder) {
  84. b.tag.Children(children...)
  85. return b
  86. }
  87. func (b *VSkeletonLoaderBuilder) AppendChildren(children ...h.HTMLComponent) (r *VSkeletonLoaderBuilder) {
  88. b.tag.AppendChildren(children...)
  89. return b
  90. }
  91. func (b *VSkeletonLoaderBuilder) PrependChildren(children ...h.HTMLComponent) (r *VSkeletonLoaderBuilder) {
  92. b.tag.PrependChildren(children...)
  93. return b
  94. }
  95. func (b *VSkeletonLoaderBuilder) Class(names ...string) (r *VSkeletonLoaderBuilder) {
  96. b.tag.Class(names...)
  97. return b
  98. }
  99. func (b *VSkeletonLoaderBuilder) ClassIf(name string, add bool) (r *VSkeletonLoaderBuilder) {
  100. b.tag.ClassIf(name, add)
  101. return b
  102. }
  103. func (b *VSkeletonLoaderBuilder) On(name string, value string) (r *VSkeletonLoaderBuilder) {
  104. b.tag.Attr(fmt.Sprintf("v-on:%s", name), value)
  105. return b
  106. }
  107. func (b *VSkeletonLoaderBuilder) Bind(name string, value string) (r *VSkeletonLoaderBuilder) {
  108. b.tag.Attr(fmt.Sprintf("v-bind:%s", name), value)
  109. return b
  110. }
  111. func (b *VSkeletonLoaderBuilder) MarshalHTML(ctx context.Context) (r []byte, err error) {
  112. return b.tag.MarshalHTML(ctx)
  113. }