-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from minswap/feat/add-github-actions
- Loading branch information
Showing
11 changed files
with
156 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Lint | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: swift-actions/setup-swift | ||
- uses: actions/checkout@4 | ||
- name: Lint | ||
run: swift format lint -r -p MinWallet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
var body: some View { | ||
HomeScreen() | ||
} | ||
var body: some View { | ||
HomeScreen() | ||
} | ||
} | ||
|
||
#Preview { | ||
ContentView() | ||
ContentView() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import SwiftUI | ||
|
||
struct HomeScreen: View { | ||
var body: some View { | ||
NavigationView { | ||
VStack { | ||
AppBar() | ||
Spacer() | ||
} | ||
}.toolbar(.hidden) | ||
} | ||
var body: some View { | ||
NavigationView { | ||
VStack { | ||
AppBar() | ||
Spacer() | ||
} | ||
}.toolbar(.hidden) | ||
} | ||
} | ||
|
||
struct HomeScreen_Preview: PreviewProvider { | ||
static var previews: some View { | ||
HomeScreen() | ||
} | ||
static var previews: some View { | ||
HomeScreen() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
import SwiftUI | ||
|
||
struct AppBar: View { | ||
var body: some View { | ||
HStack { | ||
HStack { | ||
Image("avatar") | ||
.resizable() | ||
.scaledToFit() | ||
.frame(width: 36, height: 36) | ||
.clipShape(Circle()) | ||
} | ||
.padding(2) | ||
.clipShape(Circle()) | ||
.overlay( | ||
Circle().stroke(Color.appBorderPrimarySub, lineWidth: 1) | ||
) | ||
.shadow( | ||
color: Color(red: 0, green: 0.1, blue: 0.28).opacity(0.1), | ||
radius: 3, x: 0, y: 4 | ||
) | ||
.shadow( | ||
color: Color(red: 0, green: 0.1, blue: 0.28).opacity(0.06), | ||
radius: 2, x: 0, y: 2) | ||
var body: some View { | ||
HStack { | ||
HStack { | ||
Image("avatar") | ||
.resizable() | ||
.scaledToFit() | ||
.frame(width: 36, height: 36) | ||
.clipShape(Circle()) | ||
} | ||
.padding(2) | ||
.clipShape(Circle()) | ||
.overlay( | ||
Circle().stroke(Color.appBorderPrimarySub, lineWidth: 1) | ||
) | ||
.shadow( | ||
color: Color(red: 0, green: 0.1, blue: 0.28).opacity(0.1), | ||
radius: 3, x: 0, y: 4 | ||
) | ||
.shadow( | ||
color: Color(red: 0, green: 0.1, blue: 0.28).opacity(0.06), | ||
radius: 2, x: 0, y: 2) | ||
|
||
Spacer().frame(width: 10) | ||
Spacer().frame(width: 10) | ||
|
||
Text("SassyCat").font(.labelMediumSecondary).foregroundColor( | ||
Color.appTent) | ||
Text("SassyCat").font(.labelMediumSecondary).foregroundColor( | ||
Color.appTent) | ||
|
||
Spacer() | ||
Spacer() | ||
|
||
AppIconButton(icon: .search) | ||
} | ||
.padding(.horizontal, Spacing.SpacingXl) | ||
.padding(.vertical, Spacing.SpacingXs) | ||
.frame(maxWidth: .infinity) | ||
AppIconButton(icon: .search) | ||
} | ||
.padding(.horizontal, Spacing.xl) | ||
.padding(.vertical, Spacing.xs) | ||
.frame(maxWidth: .infinity) | ||
} | ||
} | ||
|
||
struct AppBar_Previews: PreviewProvider { | ||
static var previews: some View { | ||
HStack { | ||
AppBar() | ||
} | ||
static var previews: some View { | ||
HStack { | ||
AppBar() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
import SwiftUI | ||
|
||
enum ButtonVariant { | ||
case primary | ||
case secondary | ||
case primary | ||
case secondary | ||
} | ||
|
||
struct AppButton: View { | ||
var title: String | ||
var variant: ButtonVariant | ||
var fullWidth: Bool = false | ||
var icon: IconName? | ||
var action: () -> Void | ||
var title: String | ||
var variant: ButtonVariant | ||
var fullWidth: Bool = false | ||
var icon: IconName? | ||
var action: () -> Void | ||
|
||
var body: some View { | ||
Button(action: action) { | ||
HStack(spacing: Spacing.SpacingMd) { | ||
if let icon = icon { | ||
AppIcon(name: icon) | ||
} | ||
Text(title).font(.labelMediumSecondary).foregroundColor( | ||
Color.appTent) | ||
} | ||
.frame(maxWidth: fullWidth ? .infinity : nil).padding( | ||
.horizontal, Spacing.Spacing3Xl | ||
).padding(.vertical, Spacing.SpacingMd).cornerRadius( | ||
BorderRadius.BorderRadiusFull | ||
).background( | ||
variant == .primary ? Color.appPrimary : Color.appSecondary | ||
).shadow(radius: 50).cornerRadius(BorderRadius.BorderRadiusFull) | ||
.overlay( | ||
RoundedRectangle(cornerRadius: BorderRadius.BorderRadiusFull) | ||
.stroke( | ||
variant == .primary ? Color.appPrimary : Color.appTent, | ||
lineWidth: 1) | ||
) | ||
}.buttonStyle(PlainButtonStyle()) | ||
} | ||
var body: some View { | ||
Button(action: action) { | ||
HStack(spacing: Spacing.md) { | ||
if let icon = icon { | ||
AppIcon(name: icon) | ||
} | ||
Text(title).font(.labelMediumSecondary).foregroundColor( | ||
Color.appTent) | ||
} | ||
.frame(maxWidth: fullWidth ? .infinity : nil).padding( | ||
.horizontal, Spacing._3xl | ||
).padding(.vertical, Spacing.md).cornerRadius( | ||
BorderRadius.full | ||
).background( | ||
variant == .primary ? Color.appPrimary : Color.appSecondary | ||
).shadow(radius: 50).cornerRadius(BorderRadius.full) | ||
.overlay( | ||
RoundedRectangle(cornerRadius: BorderRadius.full) | ||
.stroke( | ||
variant == .primary ? Color.appPrimary : Color.appTent, | ||
lineWidth: 1) | ||
) | ||
}.buttonStyle(PlainButtonStyle()) | ||
} | ||
} | ||
|
||
struct AppButton_Previews: PreviewProvider { | ||
static var previews: some View { | ||
VStack { | ||
AppButton( | ||
title: "Swap", variant: ButtonVariant.primary, | ||
icon: .arrowLeftDown, action: {}) | ||
AppButton( | ||
title: "Swap", variant: ButtonVariant.secondary, | ||
fullWidth: true, icon: .arrowRightUp, action: {}) | ||
}.padding() | ||
} | ||
static var previews: some View { | ||
VStack { | ||
AppButton( | ||
title: "Swap", variant: ButtonVariant.primary, | ||
icon: .arrowLeftDown, action: {}) | ||
AppButton( | ||
title: "Swap", variant: ButtonVariant.secondary, | ||
fullWidth: true, icon: .arrowRightUp, action: {}) | ||
}.padding() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import SwiftUI | ||
|
||
enum IconName: String { | ||
case arrowLeftDown = "arrow-left-down" | ||
case arrowRightUp = "arrow-right-up" | ||
case search = "search" | ||
case arrowLeftDown = "arrow-left-down" | ||
case arrowRightUp = "arrow-right-up" | ||
case search = "search" | ||
|
||
var image: Image { | ||
return Image(self.rawValue) | ||
} | ||
var image: Image { | ||
return Image(self.rawValue) | ||
} | ||
} | ||
|
||
struct AppIcon: View { | ||
var name: IconName | ||
var color: Color = Color.appTent | ||
var size: CGFloat = 20 | ||
var name: IconName | ||
var color: Color = Color.appTent | ||
var size: CGFloat = 20 | ||
|
||
var body: some View { | ||
name.image.resizable().aspectRatio(contentMode: .fit).frame( | ||
width: size, height: size | ||
).foregroundColor(.black) | ||
} | ||
var body: some View { | ||
name.image.resizable().aspectRatio(contentMode: .fit).frame( | ||
width: size, height: size | ||
).foregroundColor(.black) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import SwiftUI | ||
|
||
struct AppIconButton: View { | ||
var icon: IconName | ||
var body: some View { | ||
Button(action: {}) { | ||
Group { | ||
AppIcon(name: icon, size: 24) | ||
}.padding(Spacing.SpacingMd).clipShape(Circle()) | ||
.overlay( | ||
Circle() | ||
.stroke(Color.appBorderPrimaryTertiary, lineWidth: 1) | ||
) | ||
}.buttonStyle(PlainButtonStyle()) | ||
} | ||
var icon: IconName | ||
|
||
var body: some View { | ||
Button(action: {}) { | ||
Group { | ||
AppIcon(name: icon, size: 24) | ||
}.padding(Spacing.md).clipShape(Circle()) | ||
.overlay( | ||
Circle() | ||
.stroke(Color.appBorderPrimaryTertiary, lineWidth: 1) | ||
) | ||
}.buttonStyle(PlainButtonStyle()) | ||
} | ||
} | ||
|
||
struct AppIconButton_Preview: PreviewProvider { | ||
static var previews: some View { | ||
VStack { | ||
AppIconButton(icon: .search) | ||
} | ||
static var previews: some View { | ||
VStack { | ||
AppIconButton(icon: .search) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import SwiftUI | ||
|
||
extension Font { | ||
static let labelMediumSecondary: Font = .custom("Inter", size: 16).weight(.medium) | ||
static let labelMediumSecondary: Font = .custom("Inter", size: 16).weight(.medium) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import SwiftUI | ||
|
||
struct Spacing { | ||
static let SpacingXs: CGFloat = 4 | ||
static let SpacingMd: CGFloat = 8 | ||
static let Spacing2Md: CGFloat = 10 | ||
static let SpacingXl: CGFloat = 16 | ||
static let Spacing3Xl: CGFloat = 24 | ||
static let Spacing8Xl: CGFloat = 44 | ||
static let xs: CGFloat = 4 | ||
static let md: CGFloat = 8 | ||
static let _2md: CGFloat = 10 | ||
static let xl: CGFloat = 16 | ||
static let _3xl: CGFloat = 24 | ||
static let _8xl: CGFloat = 44 | ||
} | ||
|
||
struct BorderRadius { | ||
static let BorderRadiusFull: CGFloat = 999 | ||
static let full: CGFloat = 999 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## Format | ||
- `swift format format -r -p -i MinWallet` | ||
|
||
## Lint | ||
- `swift format lint -r -p MinWallet` | ||
|
||
## Setup rust | ||
- `./rust/build.sh` |