github.com/kotovmak/go-admin@v1.1.1/template/types/size.go (about) 1 package types 2 3 import "strconv" 4 5 // Extra small screen / phone 6 // xs: 0 7 8 // Small screen / phone 9 // sm: 576px 10 11 // Medium screen / tablet 12 // md: 768px 13 14 // Large screen / desktop 15 // lg: 992px 16 17 // Extra large screen / wide desktop 18 // xl: 1200px 19 20 type S map[string]string 21 22 func Size(sm, md, lg int) S { 23 var s = make(S) 24 if sm > 0 && sm < 13 { 25 s["sm"] = strconv.Itoa(sm) 26 } 27 if md > 0 && md < 13 { 28 s["md"] = strconv.Itoa(md) 29 } 30 if lg > 0 && lg < 13 { 31 s["lg"] = strconv.Itoa(lg) 32 } 33 return s 34 } 35 36 func (s S) LG(lg int) S { 37 if lg > 0 && lg < 13 { 38 s["lg"] = strconv.Itoa(lg) 39 } 40 return s 41 } 42 43 func (s S) XS(xs int) S { 44 if xs > 0 && xs < 13 { 45 s["xs"] = strconv.Itoa(xs) 46 } 47 return s 48 } 49 50 func (s S) XL(xl int) S { 51 if xl > 0 && xl < 13 { 52 s["xl"] = strconv.Itoa(xl) 53 } 54 return s 55 } 56 57 func (s S) SM(sm int) S { 58 if sm > 0 && sm < 13 { 59 s["sm"] = strconv.Itoa(sm) 60 } 61 return s 62 } 63 64 func (s S) MD(md int) S { 65 if md > 0 && md < 13 { 66 s["md"] = strconv.Itoa(md) 67 } 68 return s 69 } 70 71 func SizeXS(xs int) S { 72 var s = make(S) 73 if xs > 0 && xs < 13 { 74 s["xs"] = strconv.Itoa(xs) 75 } 76 return s 77 } 78 79 func SizeXL(xl int) S { 80 var s = make(S) 81 if xl > 0 && xl < 13 { 82 s["xl"] = strconv.Itoa(xl) 83 } 84 return s 85 } 86 87 func SizeSM(sm int) S { 88 var s = make(S) 89 if sm > 0 && sm < 13 { 90 s["sm"] = strconv.Itoa(sm) 91 } 92 return s 93 } 94 95 func SizeMD(md int) S { 96 var s = make(S) 97 if md > 0 && md < 13 { 98 s["md"] = strconv.Itoa(md) 99 } 100 return s 101 } 102 103 func SizeLG(lg int) S { 104 var s = make(S) 105 if lg > 0 && lg < 13 { 106 s["lg"] = strconv.Itoa(lg) 107 } 108 return s 109 }