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

Update the components #123

Merged
merged 26 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
323a2e8
Fix tokenizing of a negative value
mattesmohr Jun 16, 2023
389765d
Fix the tokenizing of an negation operator
mattesmohr Jun 16, 2023
d3e0f90
Fix missing border radius on the button component
mattesmohr Jun 17, 2023
ddb7042
Add background opacity to the button component
mattesmohr Jun 17, 2023
90148bd
Rename javascript file of the selectfield component
mattesmohr Jun 17, 2023
a2be174
Change the listener for the dropdown component
mattesmohr Jun 17, 2023
8f52a61
Fix the style for the formfield invalidation
mattesmohr Jun 17, 2023
0486317
Add opacity properties for background and border
mattesmohr Jun 17, 2023
5015ad9
Fix the stack alignment and remove the stack column component
mattesmohr Jun 18, 2023
fd9ae5f
Add an aspect ratio to the image component
mattesmohr Jun 18, 2023
e9f7b33
Add a better distinction for block and inline padding
mattesmohr Jun 18, 2023
4d4ddd3
Fix component test
mattesmohr Jun 18, 2023
98168a0
Add an edge set for the padding
mattesmohr Jun 18, 2023
40fff61
Add a view method for margins
mattesmohr Jun 19, 2023
3b53e80
Fix wrong padding declaration
mattesmohr Jun 19, 2023
eb4945d
Rename the group component
mattesmohr Jun 20, 2023
602a639
Fix the margin for the modal component
mattesmohr Jun 20, 2023
d061e3b
Revise some of the image component
mattesmohr Jun 22, 2023
5734650
Fix failing test
mattesmohr Jun 25, 2023
d455b27
Add a navigation component
mattesmohr Jun 25, 2023
dc33a5d
Add padding methods to the list component
mattesmohr Jun 25, 2023
38041b2
Revise some of the css
mattesmohr Jun 25, 2023
64a93d8
Revise the css token handling
mattesmohr Jul 1, 2023
efb8178
Create a new file for option sets
mattesmohr Jul 1, 2023
c60aec7
Add more text styling methods for the text and link component
mattesmohr Jul 1, 2023
08f40a4
Extend the state methods for button and view components with a condition
mattesmohr Jul 1, 2023
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
50 changes: 46 additions & 4 deletions Sources/HTMLKitComponents/Components/Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ extension Button: ButtonModifier {
return self.mutate(buttonstyle: style.rawValue)
}

public func disabled() -> Button {
return self.mutate(buttonstate: Tokens.ViewState.disabled.rawValue)
}

public func disabled(_ condition: Bool) -> Button {

if condition {
Expand Down Expand Up @@ -113,12 +117,21 @@ extension Button: ViewModifier {
return self.mutate(viewstate: Tokens.ViewState.hidden.rawValue)
}

public func hidden(_ condition: Bool) -> Button {

if condition {
return self.mutate(viewstate: Tokens.ViewState.hidden.rawValue)
}

return self
}

public func colorScheme(_ scheme: Tokens.ColorScheme) -> Button {
return self.mutate(scheme: scheme.rawValue)
}

public func padding(_ length: Tokens.BoxPadding) -> Button {
return self.mutate(padding: length.rawValue)
public func padding(insets: EdgeSet = .all, length: Tokens.PaddingLength = .small) -> Button {
return self.mutate(padding: length.rawValue, insets: insets)
}

public func borderShape(_ shape: Tokens.BorderShape) -> Button {
Expand All @@ -128,6 +141,14 @@ extension Button: ViewModifier {
public func borderColor(_ color: Tokens.BorderColor) -> Button {
return self.mutate(bordercolor: color.rawValue)
}

public func frame(width: Tokens.ColumnSize, offset: Tokens.ColumnOffset? = nil) -> Button {
return mutate(frame: width.rawValue, offset: offset?.rawValue)
}

public func margin(insets: EdgeSet, length: Tokens.MarginLength = .small) -> Button {
return self.mutate(margin: length.rawValue, insets: insets)
}
}

/// A component that initiates an action.
Expand Down Expand Up @@ -196,6 +217,10 @@ extension LinkButton: ButtonModifier {
return self.mutate(buttonstyle: style.rawValue)
}

public func disabled() -> LinkButton {
return self.mutate(buttonstate: Tokens.ViewState.disabled.rawValue)
}

public func disabled(_ condition: Bool) -> LinkButton {

if condition {
Expand Down Expand Up @@ -224,12 +249,21 @@ extension LinkButton: ViewModifier {
return self.mutate(viewstate: Tokens.ViewState.hidden.rawValue)
}

public func hidden(_ condition: Bool) -> LinkButton {

if condition {
return self.mutate(viewstate: Tokens.ViewState.hidden.rawValue)
}

return self
}

public func colorScheme(_ scheme: Tokens.ColorScheme) -> LinkButton {
return self.mutate(scheme: scheme.rawValue)
}

public func padding(_ length: Tokens.BoxPadding) -> LinkButton {
return self.mutate(padding: length.rawValue)
public func padding(insets: EdgeSet = .all, length: Tokens.PaddingLength = .small) -> LinkButton {
return self.mutate(padding: length.rawValue, insets: insets)
}

public func borderShape(_ shape: Tokens.BorderShape) -> LinkButton {
Expand All @@ -239,4 +273,12 @@ extension LinkButton: ViewModifier {
public func borderColor(_ color: Tokens.BorderColor) -> LinkButton {
return self.mutate(bordercolor: color.rawValue)
}

public func frame(width: Tokens.ColumnSize, offset: Tokens.ColumnOffset? = nil) -> LinkButton {
return mutate(frame: width.rawValue, offset: offset?.rawValue)
}

public func margin(insets: EdgeSet = .all, length: Tokens.MarginLength = .small) -> LinkButton {
return self.mutate(margin: length.rawValue, insets: insets)
}
}
25 changes: 21 additions & 4 deletions Sources/HTMLKitComponents/Components/Card.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,37 @@ extension Card: ViewModifier {
return self.mutate(viewstate: Tokens.ViewState.hidden.rawValue)
}

public func hidden(_ condition: Bool) -> Card {

if condition {
return self.mutate(viewstate: Tokens.ViewState.hidden.rawValue)
}

return self
}

public func colorScheme(_ scheme: Tokens.ColorScheme) -> Card {
return self.mutate(scheme: scheme.rawValue)
}

public func padding(_ length: Tokens.BoxPadding) -> Card {
return self.mutate(padding: length.rawValue)
public func padding(insets: EdgeSet = .all, length: Tokens.PaddingLength = .small) -> Card {
return self.mutate(padding: length.rawValue, insets: insets)
}

public func borderShape(_ shape: Tokens.BorderShape) -> Card {
return self.mutate(class: shape.rawValue)
return self.mutate(bordershape: shape.rawValue)
}

public func borderColor(_ color: Tokens.BorderColor) -> Card {
return self.mutate(class: color.rawValue)
return self.mutate(bordercolor: color.rawValue)
}

public func frame(width: Tokens.ColumnSize, offset: Tokens.ColumnOffset? = nil) -> Card {
return mutate(frame: width.rawValue, offset: offset?.rawValue)
}

public func margin(insets: EdgeSet = .all, length: Tokens.MarginLength = .small) -> Card {
return self.mutate(margin: length.rawValue, insets: insets)
}
}

25 changes: 23 additions & 2 deletions Sources/HTMLKitComponents/Components/Dropdown.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ extension Dropdown: ButtonModifier {
return self.mutate(buttonstyle: style.rawValue)
}

public func disabled() -> Dropdown {
return self.mutate(buttonstate: Tokens.ViewState.disabled.rawValue)
}

public func disabled(_ condition: Bool) -> Dropdown {

if condition {
Expand All @@ -83,8 +87,17 @@ extension Dropdown: ViewModifier {
return self.mutate(viewstate: Tokens.ViewState.hidden.rawValue)
}

public func padding(_ length: Tokens.BoxPadding) -> Dropdown {
return self.mutate(padding: length.rawValue)
public func hidden(_ condition: Bool) -> Dropdown {

if condition {
return self.mutate(viewstate: Tokens.ViewState.hidden.rawValue)
}

return self
}

public func padding(insets: EdgeSet = .all, length: Tokens.PaddingLength = .small) -> Dropdown {
return self.mutate(padding: length.rawValue, insets: insets)
}

public func borderShape(_ shape: Tokens.BorderShape) -> Dropdown {
Expand All @@ -102,4 +115,12 @@ extension Dropdown: ViewModifier {
public func colorScheme(_ scheme: Tokens.ColorScheme) -> Dropdown {
return self.mutate(scheme: scheme.rawValue)
}

public func frame(width: Tokens.ColumnSize, offset: Tokens.ColumnOffset? = nil) -> Dropdown {
return mutate(frame: width.rawValue, offset: offset?.rawValue)
}

public func margin(insets: EdgeSet = .all, length: Tokens.MarginLength = .small) -> Dropdown {
return self.mutate(margin: length.rawValue, insets: insets)
}
}
Loading