Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 'expand' option to section block #1339

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions block_section.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type SectionBlock struct {
BlockID string `json:"block_id,omitempty"`
Fields []*TextBlockObject `json:"fields,omitempty"`
Accessory *Accessory `json:"accessory,omitempty"`
Expand bool `json:"expand",omitempty"`
}

// BlockType returns the type of the block
Expand All @@ -25,6 +26,12 @@ func SectionBlockOptionBlockID(blockID string) SectionBlockOption {
}
}

func SectionBlockOptionExpand(expand bool) SectionBlockOption {
return func(block *SectionBlock) {
block.Expand = expand
}
}

// NewSectionBlock returns a new instance of a section block to be rendered
func NewSectionBlock(textObj *TextBlockObject, fields []*TextBlockObject, accessory *Accessory, options ...SectionBlockOption) *SectionBlock {
block := SectionBlock{
Expand Down