-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.d.ts
More file actions
92 lines (73 loc) · 1.62 KB
/
Copy pathtypes.d.ts
File metadata and controls
92 lines (73 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
type Brand<K, T> = K & { __brand: T }
type Email = Brand<string, 'email'>
type UserProp = 'email' | 'username' | 'password'
type User = Record<UserProp, | string> & {
email: Email
}
type UserPartial = Partial<User>
type NewInfo = User & {
newEmail: Email,
newUsername: string,
newPassword: string,
}
type TextFieldProp = {
onChange: (args: UserPartial) => void,
value: User,
label: string,
id: UserProp,
type: 'text' | 'password',
required?: boolean
}
type HTTP = 'POST' | 'DELETE' | 'PATCH' | 'GET'
type Category = 'Headwear' | 'Pets' | 'Hoodies' | 'Shirts' | 'Accessories'
type Item = {
id: string,
title: string,
description: string,
price: number,
category: Category,
colors: {
[key: string]: string
}
}
type ToastType = 'info' | 'success' | 'warn' | 'error'
type ToastParams = {
message: string,
type: ToastType
}
type CartItem = {
itemId: string
color: string
}
type CartState = {
cart: CartItem[]
}
type CartAction = {
addToCart: (item: CartItem) => void,
removeFromCart: (item: CartItem) => void,
resetCart: () => void,
setInitial: (items: CartItem[]) => void
}
type SessionData = {
user: {
name: string,
email: Email,
id: string,
items: CartItem[]
}
}
type QueryState = {
initialQuery: string
searchQuery: string
}
type QueryAction = {
handleInitial: (e: React.ChangeEvent<HTMLInputElement>) => void
handleSearch: () => void
}
type HrefState = {
signedInHere: string
}
type HrefAction = {
setSignedInHere: (href: string) => void,
resetHref: () => void
}