53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package line
|
|
|
|
import "errors"
|
|
|
|
// BubbleContainer -
|
|
type BubbleContainer struct {
|
|
Type string `json:"type"`
|
|
Direction NullString `json:"direction"`
|
|
Header *BoxComponent `json:"header,omitempty"`
|
|
Hero *ImageComponent `json:"hero,omitempty"`
|
|
Body *BoxComponent `json:"body,omitempty"`
|
|
Footer *BoxComponent `json:"footer,omitempty"`
|
|
Styles interface{} `json:"styles,omitempty"`
|
|
}
|
|
|
|
// CarouselContainer -
|
|
type CarouselContainer struct {
|
|
Type string `json:"type"`
|
|
Contents []*BubbleContainer `json:"contents"`
|
|
}
|
|
|
|
// NewBubbleContainer -
|
|
func NewBubbleContainer(direction string) *BubbleContainer {
|
|
obj := &BubbleContainer{}
|
|
obj.Type = "bubble"
|
|
|
|
switch direction {
|
|
case "ltr":
|
|
case "rtl":
|
|
obj.Direction = String(direction)
|
|
default:
|
|
obj.Direction = String("ltr")
|
|
}
|
|
|
|
return obj
|
|
}
|
|
|
|
// NewCarouselContainer -
|
|
func NewCarouselContainer() *CarouselContainer {
|
|
obj := &CarouselContainer{}
|
|
obj.Type = "carousel"
|
|
|
|
return obj
|
|
}
|
|
|
|
// AddContent -
|
|
func (p *CarouselContainer) AddContent(obj ...*BubbleContainer) (err error) {
|
|
if len(obj) == 0 {
|
|
return errors.New("no item")
|
|
}
|
|
return
|
|
}
|