Ui Autorization
This commit is contained in:
commit
39eaed8532
14 files changed
+915
No files matched your search
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
@State private var login: String = ""
|
||||
@State private var password: String = ""
|
||||
@State private var isRegistrationVisible: Bool = false
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
Text("Добро пожаловать!")
|
||||
.font(.title)
|
||||
.padding(.top, 20)
|
||||
.padding(.leading, 10)
|
||||
|
||||
HStack(spacing: -20) {
|
||||
Button(action: {
|
||||
// Действие для кнопки "Вход"
|
||||
isRegistrationVisible = false
|
||||
}) {
|
||||
Text("Вход")
|
||||
.padding()
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(isRegistrationVisible ? Color.gray.opacity(0.2) : Color.blue)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(20)
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
// Действие для кнопки "Регистрация"
|
||||
isRegistrationVisible = true
|
||||
}) {
|
||||
Text("Регистрация")
|
||||
.padding()
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(isRegistrationVisible ? Color.blue : Color.gray.opacity(0.2))
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(20)
|
||||
}
|
||||
}
|
||||
.padding(.top, 10)
|
||||
.padding(.horizontal, 10)
|
||||
|
||||
Color.clear
|
||||
.frame(height: 15)
|
||||
|
||||
if isRegistrationVisible {
|
||||
RegistrationView()
|
||||
} else {
|
||||
TextField("Телефон, почта или ник", text: $login)
|
||||
.padding()
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.cornerRadius(10)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(height: 60)
|
||||
|
||||
TextField("Пароль", text: $password)
|
||||
.padding()
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.cornerRadius(10)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(height: 60)
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
// Действие для кнопки "Забыли пароль?"
|
||||
}) {
|
||||
Text("Забыли пароль?")
|
||||
.foregroundColor(.blue)
|
||||
.padding(.top, 10)
|
||||
.padding(.horizontal, 10)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
// Действие для кнопки "Продолжить"
|
||||
}) {
|
||||
Text("Продолжить")
|
||||
.padding()
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(Color.gray.opacity(0.2))
|
||||
.foregroundColor(.black)
|
||||
.cornerRadius(20)
|
||||
}
|
||||
.padding(.bottom, 20) // Добавляем отступ снизу
|
||||
}
|
||||
.padding(.horizontal, 10)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.padding(.bottom, 10) // Добавляем отступ снизу для контейнера
|
||||
}
|
||||
}
|
||||
|
||||
struct RegistrationView: View {
|
||||
@State private var name: String = ""
|
||||
@State private var surname: String = ""
|
||||
@State private var email: String = ""
|
||||
@State private var password: String = ""
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
TextField("Имя", text: $name)
|
||||
.padding()
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.cornerRadius(10)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(height: 60)
|
||||
|
||||
TextField("Фамилия", text: $surname)
|
||||
.padding()
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.cornerRadius(10)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(height: 60)
|
||||
|
||||
TextField("Email", text: $email)
|
||||
.padding()
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.cornerRadius(10)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(height: 60)
|
||||
|
||||
TextField("Пароль", text: $password)
|
||||
.padding()
|
||||
.background(Color.gray.opacity(0.1))
|
||||
.cornerRadius(10)
|
||||
.padding(.horizontal, 10)
|
||||
.frame(height: 60)
|
||||
}
|
||||
.padding(.horizontal, 10)
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// SwUIApp.swift
|
||||
// SwUI
|
||||
//
|
||||
// Created by User on 07.03.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct SwUIApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user