Skip to content

Commit

Permalink
Merge pull request #8 from minswap/feat/add-github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
0xj4m35 authored Nov 19, 2024
2 parents 5abc2c8 + a79bb7e commit 788f26a
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 133 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/lint.yaml
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
8 changes: 4 additions & 4 deletions MinWallet/ContentView.swift
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()
}
22 changes: 11 additions & 11 deletions MinWallet/Features/Home/HomeScreen.swift
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()
}
}
8 changes: 4 additions & 4 deletions MinWallet/MinWalletApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import SwiftUI

@main
struct MinWalletApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
68 changes: 34 additions & 34 deletions MinWallet/Shared/Components/AppBar.swift
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()
}
}
}
82 changes: 41 additions & 41 deletions MinWallet/Shared/Components/AppButton.swift
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()
}
}
28 changes: 14 additions & 14 deletions MinWallet/Shared/Components/AppIcon.swift
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)
}
}
34 changes: 17 additions & 17 deletions MinWallet/Shared/Components/AppIconButton.swift
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)
}
}
}
2 changes: 1 addition & 1 deletion MinWallet/Shared/Theme/Font.swift
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)
}
14 changes: 7 additions & 7 deletions MinWallet/Shared/Theme/Others.swift
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
}
8 changes: 8 additions & 0 deletions README.md
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`

0 comments on commit 788f26a

Please sign in to comment.