Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Add example templates for Spacing feature
Browse files Browse the repository at this point in the history
  • Loading branch information
freak4pc committed Apr 10, 2020
1 parent c1544ca commit 4ed4633
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Examples/Android/dimens.xml.prism
@@ -0,0 +1,7 @@
<!-- This file was generated using Prism -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
{{% FOR spacing %}}
<dimen name="{{% spacing.identity.snakecase %}}">{{% spacing.value %}}dp</dimen>
{{% END spacing %}}
</resources>
8 changes: 8 additions & 0 deletions Examples/iOS/SwiftUI/Spacing.swift.prism
@@ -0,0 +1,8 @@
// This file was generated using Prism
import Foundation

enum Spacing {
{{% FOR spacing %}}
static let {{% spacing.identity.camelcase %}} = CGFloat({{% spacing.value %}})
{{% END spacing %}}
}
8 changes: 8 additions & 0 deletions Examples/iOS/UIKit/Spacing.swift.prism
@@ -0,0 +1,8 @@
// This file was generated using Prism
import Foundation

enum Spacing {
{{% FOR spacing %}}
static let {{% spacing.identity.camelcase %}} = {{% spacing.value %}}
{{% END spacing %}}
}
8 changes: 4 additions & 4 deletions Examples/iOS/UIKit/TextStyles.swift.prism
Expand Up @@ -10,10 +10,10 @@ extension TextStyle {
// UI element in your app. See `TextStyle.swift` for some
// more inspiration around this.
{{% FOR textStyle %}}
static let {{%textStyle.identity.camelcase%}} = TextStyle(
fontName: "{{%textStyle.fontName%}}",
fontSize: {{%textStyle.fontSize%}},
color: .{{%textStyle.color.identity.camelcase%}}{{% IF textStyle.alignment %}},{{% ENDIF %}}
static let {{% textStyle.identity.camelcase %}} = TextStyle(
fontName: "{{% textStyle.fontName %}}",
fontSize: {{% textStyle.fontSize %}},
color: .{{% textStyle.color.identity.camelcase %}}{{% IF textStyle.alignment %}},{{% ENDIF %}}
{{% IF textStyle.alignment %}}alignment: .{{%textStyle.alignment|replace(justify,justified)%}}{{% ENDIF %}}
)

Expand Down
6 changes: 3 additions & 3 deletions Sources/PrismCore/TemplateParser/TemplateParser+Token.swift
Expand Up @@ -163,9 +163,9 @@ extension TemplateParser {
var baseString: String?
switch self {
case let .colorIdentity(identity, style),
let .textStyleIdentity(identity, style),
let .spacingIdentity(identity, style):
baseString = style.identifier(for: identity)
let .textStyleIdentity(identity, style),
let .spacingIdentity(identity, style):
b]aseString = style.identifier(for: identity)
case .colorAlpha(let alpha):
baseString = String(format: "%.2f", alpha)
case .colorRed(let c),
Expand Down

0 comments on commit 4ed4633

Please sign in to comment.