Skip to content

Commit

Permalink
Update PopoverConfiguration
Browse files Browse the repository at this point in the history
Move PopoverConfiguration.swift into its own folder

Move nested types into their own files

Rename `Layout` to `ContentLayout`

Misc additional changes
  • Loading branch information
jordanbaird committed Nov 1, 2023
1 parent 8c6accc commit adcf565
Show file tree
Hide file tree
Showing 9 changed files with 786 additions and 712 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# ``ColorWellKit/ColorWell/PopoverConfiguration-swift.struct/Layout-swift.struct``
# ``ColorWellKit/ColorWell/PopoverConfiguration-swift.struct/ContentLayout-swift.struct``

## Topics

### Available layouts
### Available content layouts

- ``grid(columnCount:horizontalSpacing:verticalSpacing:topRowSpacing:)``

### Adding padding to a layout
### Adding padding to a content layout

- ``padding(minLeading:maxLeading:minTrailing:maxTrailing:minTop:maxTop:minBottom:maxBottom:)``
- ``padding(leading:trailing:top:bottom:)``
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

### Creating a popover configuration

- ``init(colors:layout:swatchSize:swatchShape:borderEffect:)``
- ``init(colorList:layout:swatchSize:swatchShape:borderEffect:)``
- ``init(colors:contentLayout:swatchSize:swatchShape:borderEffect:)``
- ``init(colorList:contentLayout:swatchSize:swatchShape:borderEffect:)``

### Accessing a configuration's values

- ``colors``
- ``layout-swift.property``
- ``contentLayout-swift.property``
- ``swatchSize``
- ``swatchShape-swift.property``
- ``borderEffect``
Expand All @@ -23,6 +23,6 @@

### Supporting Types

- ``Layout-swift.struct``
- ``ContentLayout-swift.struct``
- ``SwatchShape-swift.struct``
- ``SwatchBorderEffect``
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ extension ColorWellPopover {
switch style {
case .standard, .expanded:
return (
leading: configuration.layout.padding.leading.max ?? fallbackPadding,
trailing: configuration.layout.padding.trailing.max ?? fallbackPadding,
top: configuration.layout.padding.top.max ?? fallbackPadding,
bottom: configuration.layout.padding.bottom.max ?? fallbackPadding
leading: configuration.contentLayout.padding.leading.max ?? fallbackPadding,
trailing: configuration.contentLayout.padding.trailing.max ?? fallbackPadding,
top: configuration.contentLayout.padding.top.max ?? fallbackPadding,
bottom: configuration.contentLayout.padding.bottom.max ?? fallbackPadding
)
case .swatches:
return (
leading: configuration.layout.padding.leading.min ?? fallbackPadding,
trailing: configuration.layout.padding.trailing.min ?? fallbackPadding,
top: configuration.layout.padding.top.min ?? fallbackPadding,
bottom: configuration.layout.padding.bottom.min ?? fallbackPadding
leading: configuration.contentLayout.padding.leading.min ?? fallbackPadding,
trailing: configuration.contentLayout.padding.trailing.min ?? fallbackPadding,
top: configuration.contentLayout.padding.top.min ?? fallbackPadding,
bottom: configuration.contentLayout.padding.bottom.min ?? fallbackPadding
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ extension ColorWellPopover.LayoutView {
init(colorWell: ColorWell, configuration: Configuration) {
self.selectionIndicator = SelectionIndicator(configuration: configuration)
super.init(frame: .zero)
switch configuration.layout.kind {
switch configuration.contentLayout.kind {
case .grid(_, let horizontalSpacing, let verticalSpacing, _):
self.rowSpacing = verticalSpacing ?? 1
self.columnSpacing = horizontalSpacing ?? 1
Expand Down Expand Up @@ -158,7 +158,7 @@ extension ColorWellPopover.LayoutView {
swatches.removeAll()

let (columnCount, topRowSpacing) = {
switch configuration.layout.kind {
switch configuration.contentLayout.kind {
case let .grid(_, _, _, topRowSpacing):
return (configuration.computeColumnCount(), topRowSpacing)
}
Expand Down
Loading

0 comments on commit adcf565

Please sign in to comment.