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 Primary/Secondary/Tertiary/QuaternaryContentStyle #419

Merged
merged 3 commits into from
Jul 7, 2021

Conversation

carson-katri
Copy link
Member

@carson-katri carson-katri commented Jul 7, 2021

These styles have 2 different behaviors:

  1. Use the styles specified in a foregroundStyle modifier:
Group {
  Text("Primary").foregroundStyle(.primary)
  Text("Secondary").foregroundStyle(.secondary)
  Text("Tertiary").foregroundStyle(.tertiary)
  Text("Quaternary").foregroundStyle(.quaternary)
}
.foregroundStyle(.red, .green, .blue)

Screen Shot 2021-07-07 at 5 43 14 PM

  1. Use the foreground color and apply opacity:
Group {
  Text("Primary").foregroundStyle(.primary)
  Text("Secondary").foregroundStyle(.secondary)
  Text("Tertiary").foregroundStyle(.tertiary)
  Text("Quaternary").foregroundStyle(.quaternary)
}
.foregroundColor(.blue)

Screen Shot 2021-07-07 at 5 44 16 PM

@carson-katri carson-katri added the SwiftUI compatibility Tokamak API differences with SwiftUI label Jul 7, 2021
@MaxDesiatov MaxDesiatov added the DOM/HTML renderer Tokamak in the browser label Jul 7, 2021
@carson-katri carson-katri requested a review from a team July 7, 2021 22:10
if !shape.inRecursiveStyle,
let foregroundStyle = shape.environment._foregroundStyle
{
if foregroundStyle.styles[0] is Self {
Copy link
Collaborator

@MaxDesiatov MaxDesiatov Jul 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a certainty that foregroundStyle.styles is always non-empty? If so, maybe this needs a comment in code to explain that?

Also, this PR needs conflicts to be resolved 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced the array with a tuple to guarantee its non-empty.

Copy link
Collaborator

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet! 🙌

@carson-katri carson-katri merged commit 2efa80a into main Jul 7, 2021
@carson-katri carson-katri deleted the content-styles branch July 7, 2021 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM/HTML renderer Tokamak in the browser SwiftUI compatibility Tokamak API differences with SwiftUI
Development

Successfully merging this pull request may close these issues.

2 participants