Skip to content

Commit 946bb1f

Browse files
committed
main axis size
1 parent 7e28b94 commit 946bb1f

5 files changed

Lines changed: 30 additions & 0 deletions

File tree

basic/div/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ func AlignItems(alignItems options.AxisAlignmentType) Option {
1414
}
1515
}
1616

17+
func AlignSelf(alignSelf options.AxisSizeType) Option {
18+
return func() options.Option {
19+
return options.AlignSelf(alignSelf)
20+
}
21+
}
22+
1723
func Alt(alt string) Option {
1824
return func() options.Option {
1925
return options.Alt(alt)

foundation/column/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ func MainAxisAlignment(mainAxisAlignment options.AxisAlignmentType) Option {
5454
column.opts = append(column.opts, div.AlignItems(mainAxisAlignment))
5555
}
5656
}
57+
58+
func MainAxisSize(mainAxisSize options.AxisSizeType) Option {
59+
return func(column *column) {
60+
column.opts = append(column.opts, div.AlignSelf(mainAxisSize))
61+
}
62+
}

foundation/row/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ func MainAxisAlignment(mainAxisAlignment options.AxisAlignmentType) Option {
5454
row.opts = append(row.opts, div.JustifyContent(mainAxisAlignment))
5555
}
5656
}
57+
58+
func MainAxisSize(mainAxisSize options.AxisSizeType) Option {
59+
return func(row *row) {
60+
row.opts = append(row.opts, div.AlignSelf(mainAxisSize))
61+
}
62+
}

options/enum.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package options
22

33
type AxisAlignmentType string
4+
type AxisSizeType string
45
type BorderStyleType string
56
type DisplayType string
67
type FlexDirectionType string
@@ -15,6 +16,11 @@ const (
1516
AxisAlignmentTypeBaseline AxisAlignmentType = "baseline"
1617
)
1718

19+
const (
20+
AxisSizeTypeMax AxisSizeType = "stretch"
21+
AxisSizeTypeMin AxisSizeType = "start"
22+
)
23+
1824
const (
1925
BorderStyleTypeSolid BorderStyleType = "solid"
2026
BorderStyleTypeDashed BorderStyleType = "dashed"

options/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ func AlignItems(alignItems AxisAlignmentType) Option {
2121
}
2222
}
2323

24+
func AlignSelf(alignSelf AxisSizeType) Option {
25+
return func(widget widget.BaseWidget) {
26+
widget.UpdateStyleProperty("align-self", string(alignSelf))
27+
}
28+
}
29+
2430
func Alt(alt string) Option {
2531
return func(widget widget.BaseWidget) {
2632
widget.SetAttribute("alt", alt)

0 commit comments

Comments
 (0)