Skip to content

Commit

Permalink
feat: add action func for ysk card
Browse files Browse the repository at this point in the history
  • Loading branch information
CorrectRoadH committed Aug 15, 2024
1 parent 6b6d149 commit e83bfb6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/ysk/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ func (yskCard YSKCard) WithList(params []YSKCardListItem) YSKCard {
return yskCard
}

// it will replace the old action by same side and style
func (YSKCard YSKCard) UpsertFooterAction(action YSKCardFooterAction) YSKCard {
for i, a := range YSKCard.Content.FooterActions {
if a.Side == action.Side && a.Style == action.Style {
YSKCard.Content.FooterActions[i] = action
}
}
return YSKCard
}

type YSKCardContent struct {
TitleIcon YSKCardIcon `json:"titleIcon" gorm:"column:title_icon"`
TitleText string `json:"titleText" gorm:"column:title_text"`
Expand Down

0 comments on commit e83bfb6

Please sign in to comment.