fiboui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -0
- package/dist/content/Alert/index.d.ts +878 -0
- package/dist/content/Avatar/index.d.ts +886 -0
- package/dist/content/Badge/index.d.ts +887 -0
- package/dist/content/Image/index.d.ts +893 -0
- package/dist/content/Label/index.d.ts +879 -0
- package/dist/content/Progress/index.d.ts +898 -0
- package/dist/content/Skeleton/index.d.ts +879 -0
- package/dist/content/Spinner/index.d.ts +880 -0
- package/dist/content/Text/index.d.ts +878 -0
- package/dist/content/index.d.ts +9 -0
- package/dist/core/StateWrapper.d.ts +28 -0
- package/dist/core/builder.d.ts +50 -0
- package/dist/core/component.d.ts +7 -0
- package/dist/core/effects.d.ts +3 -0
- package/dist/core/icons.d.ts +11 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/state.d.ts +37 -0
- package/dist/core/types.d.ts +51 -0
- package/dist/demo.d.ts +7 -0
- package/dist/effects-Co9C_Dyx.mjs +9 -0
- package/dist/examples/ScaffoldExamples.d.ts +3 -0
- package/dist/examples/StateExamples.d.ts +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +4622 -0
- package/dist/index.umd.js +251 -0
- package/dist/interactive/Button/index.d.ts +897 -0
- package/dist/interactive/Checkbox/index.d.ts +884 -0
- package/dist/interactive/Combobox/index.d.ts +898 -0
- package/dist/interactive/RadioGroup/index.d.ts +888 -0
- package/dist/interactive/Select/index.d.ts +895 -0
- package/dist/interactive/Switch/index.d.ts +881 -0
- package/dist/interactive/TextField/index.d.ts +892 -0
- package/dist/interactive/Textarea/index.d.ts +890 -0
- package/dist/interactive/index.d.ts +8 -0
- package/dist/layout/Center/index.d.ts +869 -0
- package/dist/layout/Column/index.d.ts +881 -0
- package/dist/layout/Container/index.d.ts +870 -0
- package/dist/layout/DashboardLayout/index.d.ts +870 -0
- package/dist/layout/Header/index.d.ts +870 -0
- package/dist/layout/Line/index.d.ts +872 -0
- package/dist/layout/Row/index.d.ts +879 -0
- package/dist/layout/Scaffold/index.d.ts +878 -0
- package/dist/layout/ScrollView/index.d.ts +879 -0
- package/dist/layout/Sidebar/index.d.ts +870 -0
- package/dist/layout/Spacer/index.d.ts +875 -0
- package/dist/layout/StakentComponents.d.ts +4 -0
- package/dist/layout/index.d.ts +11 -0
- package/dist/structure/Banner/index.d.ts +879 -0
- package/dist/structure/Box/index.d.ts +869 -0
- package/dist/structure/Card/index.d.ts +881 -0
- package/dist/structure/Collapse/index.d.ts +884 -0
- package/dist/structure/Grid/index.d.ts +1757 -0
- package/dist/structure/List/index.d.ts +888 -0
- package/dist/structure/Table/index.d.ts +895 -0
- package/dist/structure/Tags/index.d.ts +876 -0
- package/dist/structure/cards/AssetCard/index.d.ts +884 -0
- package/dist/structure/cards/CollectionCard/index.d.ts +880 -0
- package/dist/structure/cards/ContentCard/index.d.ts +884 -0
- package/dist/structure/cards/ProfileCard/index.d.ts +892 -0
- package/dist/structure/cards/index.d.ts +5 -0
- package/dist/structure/cards/variants/index.d.ts +3490 -0
- package/dist/structure/index.d.ts +9 -0
- package/dist/style.css +1 -0
- package/dist/theme/cupertino.d.ts +3 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme/material.d.ts +3 -0
- package/dist/theme/provider.d.ts +16 -0
- package/dist/theme/types.d.ts +57 -0
- package/dist/theme/web.d.ts +3 -0
- package/package.json +54 -0
- package/src/content/Alert/index.ts +110 -0
- package/src/content/Avatar/index.ts +116 -0
- package/src/content/Badge/index.ts +162 -0
- package/src/content/Image/index.ts +137 -0
- package/src/content/Label/index.ts +66 -0
- package/src/content/Progress/index.ts +378 -0
- package/src/content/Skeleton/index.ts +71 -0
- package/src/content/Spinner/index.ts +139 -0
- package/src/content/Text/index.ts +74 -0
- package/src/content/index.ts +9 -0
- package/src/core/StateWrapper.tsx +105 -0
- package/src/core/builder.ts +259 -0
- package/src/core/component.ts +49 -0
- package/src/core/effects.ts +27 -0
- package/src/core/icons.tsx +57 -0
- package/src/core/index.ts +5 -0
- package/src/core/state.ts +233 -0
- package/src/core/types.ts +62 -0
- package/src/demo.tsx +1045 -0
- package/src/examples/ScaffoldExamples.tsx +299 -0
- package/src/examples/StateExamples.tsx +149 -0
- package/src/index.ts +8 -0
- package/src/interactive/Button/index.ts +218 -0
- package/src/interactive/Checkbox/index.ts +145 -0
- package/src/interactive/Combobox/index.ts +278 -0
- package/src/interactive/RadioGroup/index.ts +124 -0
- package/src/interactive/Select/index.ts +227 -0
- package/src/interactive/Switch/index.ts +123 -0
- package/src/interactive/TextField/index.ts +200 -0
- package/src/interactive/Textarea/index.ts +129 -0
- package/src/interactive/index.ts +8 -0
- package/src/layout/Center/index.ts +34 -0
- package/src/layout/Column/index.ts +101 -0
- package/src/layout/Container/index.ts +28 -0
- package/src/layout/DashboardLayout/index.ts +106 -0
- package/src/layout/Header/index.ts +50 -0
- package/src/layout/Line/index.ts +41 -0
- package/src/layout/Row/index.ts +93 -0
- package/src/layout/Scaffold/index.ts +133 -0
- package/src/layout/ScrollView/index.ts +67 -0
- package/src/layout/Sidebar/index.ts +56 -0
- package/src/layout/Spacer/index.ts +46 -0
- package/src/layout/StakentComponents.tsx +57 -0
- package/src/layout/index.ts +11 -0
- package/src/structure/Banner/index.ts +92 -0
- package/src/structure/Box/index.ts +45 -0
- package/src/structure/Card/index.ts +113 -0
- package/src/structure/Collapse/index.ts +122 -0
- package/src/structure/Grid/index.ts +197 -0
- package/src/structure/List/index.ts +185 -0
- package/src/structure/Table/index.ts +165 -0
- package/src/structure/Tags/index.ts +69 -0
- package/src/structure/cards/AssetCard/index.ts +158 -0
- package/src/structure/cards/CollectionCard/index.ts +95 -0
- package/src/structure/cards/ContentCard/index.ts +127 -0
- package/src/structure/cards/ProfileCard/index.ts +152 -0
- package/src/structure/cards/index.ts +5 -0
- package/src/structure/cards/variants/index.ts +301 -0
- package/src/structure/index.ts +10 -0
- package/src/styles/base.css +186 -0
- package/src/styles/core.css +52 -0
- package/src/styles/themes/cupertino.css +197 -0
- package/src/styles/themes/material.css +322 -0
- package/src/styles/themes/web.css +196 -0
- package/src/theme/cupertino.ts +85 -0
- package/src/theme/index.ts +5 -0
- package/src/theme/material.ts +86 -0
- package/src/theme/provider.tsx +76 -0
- package/src/theme/types.ts +62 -0
- package/src/theme/web.ts +82 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { FiboBuilder, createBuilder } from '../../../core/builder';
|
|
3
|
+
import { BaseProps } from '../../../core/types';
|
|
4
|
+
import { Box } from '../../Box';
|
|
5
|
+
import { Text } from '../../../content/Text';
|
|
6
|
+
import { Row } from '../../../layout/Row';
|
|
7
|
+
import { Column } from '../../../layout/Column';
|
|
8
|
+
import { Spacer } from '../../../layout/Spacer';
|
|
9
|
+
import { Button } from '../../../interactive/Button';
|
|
10
|
+
import { Card } from '../../Card';
|
|
11
|
+
import { Badge } from '../../../content/Badge';
|
|
12
|
+
import { Icons } from '../../../core/icons';
|
|
13
|
+
|
|
14
|
+
const AssetCardInner = React.memo((props: any) => {
|
|
15
|
+
const { image, title, price, likes, timeLeft, className, style, ...rest } = props;
|
|
16
|
+
|
|
17
|
+
return Card()
|
|
18
|
+
.classNames(['group', 'transition-all', 'duration-300', 'hover:-translate-y-1'])
|
|
19
|
+
.style({
|
|
20
|
+
width: '100%',
|
|
21
|
+
borderRadius: '24px',
|
|
22
|
+
border: 'none',
|
|
23
|
+
boxShadow: '0 10px 40px -10px rgba(0,0,0,0.05)',
|
|
24
|
+
padding: '16px',
|
|
25
|
+
background: '#fff',
|
|
26
|
+
...style
|
|
27
|
+
})
|
|
28
|
+
.className(className)
|
|
29
|
+
.props(rest)
|
|
30
|
+
.children([
|
|
31
|
+
|
|
32
|
+
Box().classNames(['relative', 'aspect-square', 'overflow-hidden', 'rounded-[20px]']).children([
|
|
33
|
+
Box()
|
|
34
|
+
.classNames(['w-full', 'h-full', 'bg-gray-200', 'bg-cover', 'bg-center'])
|
|
35
|
+
.style({ backgroundImage: `url(${image})` })
|
|
36
|
+
.build(),
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Box()
|
|
40
|
+
.classNames(['absolute', 'top-3', 'right-3'])
|
|
41
|
+
.children(
|
|
42
|
+
Badge().variant("glass").shape("pill")
|
|
43
|
+
.icon(Box().classNames(['text-gray-400', 'hover:text-red-500']).children(Icons.Heart).build())
|
|
44
|
+
.text(`${likes}`)
|
|
45
|
+
.build()
|
|
46
|
+
).build()
|
|
47
|
+
]).build(),
|
|
48
|
+
|
|
49
|
+
Spacer().height(16).build(),
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
Row().justifyContent("between").alignItems("start").children([
|
|
53
|
+
Column().gap(4).children([
|
|
54
|
+
Text(title).fontWeight(700).fontSize(18).color("#111827").build(),
|
|
55
|
+
Badge().variant("neutral").text("Not for sale x1").build()
|
|
56
|
+
]).build(),
|
|
57
|
+
Box().classNames(['text-gray-300']).children(Icons.More).build()
|
|
58
|
+
]).build(),
|
|
59
|
+
|
|
60
|
+
Spacer().height(16).build(),
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
Row().justifyContent("between").alignItems("center").children([
|
|
64
|
+
Column().gap(4).children([
|
|
65
|
+
Text("Current Bid").fontSize(11).fontWeight(600).color("#6B7280").build(),
|
|
66
|
+
Row().gap(4).alignItems("center").children([
|
|
67
|
+
Box().classNames(['text-blue-500']).children(Icons.Eth).build(),
|
|
68
|
+
Text(`${price} ETH`).fontSize(15).fontWeight(700).color("#111827").build(),
|
|
69
|
+
]).build()
|
|
70
|
+
]).build(),
|
|
71
|
+
|
|
72
|
+
Button("Place a bid")
|
|
73
|
+
.variant("filled")
|
|
74
|
+
.shape("pill")
|
|
75
|
+
.shadow("soft")
|
|
76
|
+
.style({
|
|
77
|
+
backgroundColor: '#111827',
|
|
78
|
+
color: '#fff',
|
|
79
|
+
padding: '10px 20px',
|
|
80
|
+
fontSize: '13px',
|
|
81
|
+
fontWeight: 600
|
|
82
|
+
})
|
|
83
|
+
.build()
|
|
84
|
+
]).build(),
|
|
85
|
+
|
|
86
|
+
Spacer().height(12).build(),
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
timeLeft ?
|
|
90
|
+
Badge()
|
|
91
|
+
.variant("accent")
|
|
92
|
+
.shape("rounded")
|
|
93
|
+
.icon(Box().children(Icons.Clock).build())
|
|
94
|
+
.text(timeLeft)
|
|
95
|
+
.style({ width: '100%' })
|
|
96
|
+
.build()
|
|
97
|
+
: null
|
|
98
|
+
|
|
99
|
+
]).build();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
class AssetCardBuilder extends FiboBuilder {
|
|
103
|
+
private _image: string = '';
|
|
104
|
+
private _title: string = '';
|
|
105
|
+
private _price: string | number = '';
|
|
106
|
+
private _likes: string | number = '';
|
|
107
|
+
private _timeLeft?: string;
|
|
108
|
+
|
|
109
|
+
image(url: string): this {
|
|
110
|
+
this._image = url;
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
title(text: string): this {
|
|
115
|
+
this._title = text;
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
price(value: string | number): this {
|
|
120
|
+
this._price = value;
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
likes(count: string | number): this {
|
|
125
|
+
this._likes = count;
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
timeLeft(time: string): this {
|
|
130
|
+
this._timeLeft = time;
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
build(): ReactElement {
|
|
135
|
+
const props = {
|
|
136
|
+
image: this._image,
|
|
137
|
+
title: this._title,
|
|
138
|
+
price: this._price,
|
|
139
|
+
likes: this._likes,
|
|
140
|
+
timeLeft: this._timeLeft,
|
|
141
|
+
className: this.getClassName(),
|
|
142
|
+
style: this.getStyle(),
|
|
143
|
+
...this._props
|
|
144
|
+
};
|
|
145
|
+
return React.createElement(AssetCardInner, props);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
export const AssetCard = createBuilder(AssetCardBuilder);
|
|
151
|
+
|
|
152
|
+
export interface AssetCardProps extends BaseProps {
|
|
153
|
+
image: string;
|
|
154
|
+
title: string;
|
|
155
|
+
price: string | number;
|
|
156
|
+
likes: string | number;
|
|
157
|
+
timeLeft?: string;
|
|
158
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { FiboBuilder, createBuilder } from '../../../core/builder';
|
|
3
|
+
import { BaseProps } from '../../../core/types';
|
|
4
|
+
import { Box } from '../../Box';
|
|
5
|
+
import { Text } from '../../../content/Text';
|
|
6
|
+
import { Row } from '../../../layout/Row';
|
|
7
|
+
import { Column } from '../../../layout/Column';
|
|
8
|
+
import { Card } from '../../Card';
|
|
9
|
+
import { Icons } from '../../../core/icons';
|
|
10
|
+
|
|
11
|
+
const CollectionCardInner = React.memo((props: any) => {
|
|
12
|
+
const { image, title, author, items, className, style, ...rest } = props;
|
|
13
|
+
|
|
14
|
+
return Card()
|
|
15
|
+
.classNames(['group', 'cursor-pointer'])
|
|
16
|
+
.style({
|
|
17
|
+
width: '100%',
|
|
18
|
+
borderRadius: '24px',
|
|
19
|
+
height: '320px',
|
|
20
|
+
position: 'relative',
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
border: 'none',
|
|
23
|
+
...style
|
|
24
|
+
})
|
|
25
|
+
.className(className)
|
|
26
|
+
.props(rest)
|
|
27
|
+
.children([
|
|
28
|
+
|
|
29
|
+
Box().classNames(['absolute', 'inset-0', 'bg-cover', 'bg-center', 'transition-transform', 'duration-500'])
|
|
30
|
+
.style({ backgroundImage: `url(${image})` }).build(),
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Box().classNames(['absolute', 'inset-0', 'bg-gradient-to-t', 'from-black/80', 'via-black/20', 'to-transparent']).build(),
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Column().classNames(['absolute', 'bottom-0', 'left-0', 'p-6']).gap(4).children([
|
|
37
|
+
Text(items).color("white").fontSize(12).classNames(['opacity-90', 'mb-1', 'uppercase', 'tracking-wider']).fontWeight(600).build(),
|
|
38
|
+
Text(title).color("white").fontSize(22).fontWeight(700).build(),
|
|
39
|
+
Row().gap(6).alignItems("center").children([
|
|
40
|
+
Text("Created by").color("white").fontSize(13).classNames(['opacity-80']).build(),
|
|
41
|
+
Text(author).color("white").fontSize(13).fontWeight(600).build(),
|
|
42
|
+
Icons.Verify
|
|
43
|
+
]).build()
|
|
44
|
+
]).build()
|
|
45
|
+
]).build();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
class CollectionCardBuilder extends FiboBuilder {
|
|
49
|
+
private _image: string = '';
|
|
50
|
+
private _title: string = '';
|
|
51
|
+
private _author: string = '';
|
|
52
|
+
private _items: string = '';
|
|
53
|
+
|
|
54
|
+
image(url: string): this {
|
|
55
|
+
this._image = url;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
title(text: string): this {
|
|
60
|
+
this._title = text;
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
author(text: string): this {
|
|
65
|
+
this._author = text;
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
items(text: string): this {
|
|
70
|
+
this._items = text;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
build(): ReactElement {
|
|
75
|
+
const props = {
|
|
76
|
+
image: this._image,
|
|
77
|
+
title: this._title,
|
|
78
|
+
author: this._author,
|
|
79
|
+
items: this._items,
|
|
80
|
+
className: this.getClassName(),
|
|
81
|
+
style: this.getStyle(),
|
|
82
|
+
...this._props
|
|
83
|
+
};
|
|
84
|
+
return React.createElement(CollectionCardInner, props);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
export const CollectionCard = createBuilder(CollectionCardBuilder);
|
|
90
|
+
|
|
91
|
+
export interface CollectionCardProps extends BaseProps {
|
|
92
|
+
image: string;
|
|
93
|
+
title: string;
|
|
94
|
+
author: string;
|
|
95
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { FiboBuilder, createBuilder } from '../../../core/builder';
|
|
3
|
+
import { BaseProps } from '../../../core/types';
|
|
4
|
+
import { Card } from '../../Card';
|
|
5
|
+
import { Image } from '../../../content/Image';
|
|
6
|
+
import { Text } from '../../../content/Text';
|
|
7
|
+
import { Box } from '../../Box';
|
|
8
|
+
|
|
9
|
+
const ContentCardInner = React.memo((props: any) => {
|
|
10
|
+
const {
|
|
11
|
+
image,
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
date,
|
|
15
|
+
source,
|
|
16
|
+
className,
|
|
17
|
+
style
|
|
18
|
+
} = props;
|
|
19
|
+
|
|
20
|
+
return Card()
|
|
21
|
+
.className(`overflow-hidden hover:shadow-lg transition-shadow duration-300 ${className}`)
|
|
22
|
+
.style(style)
|
|
23
|
+
.children([
|
|
24
|
+
|
|
25
|
+
image ? Image()
|
|
26
|
+
.src(image)
|
|
27
|
+
.className("w-full object-cover rounded-[20px] mb-4")
|
|
28
|
+
.style({ height: '200px' })
|
|
29
|
+
.build() : null,
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Box()
|
|
33
|
+
.className("flex flex-col gap-2")
|
|
34
|
+
.children([
|
|
35
|
+
|
|
36
|
+
title ? Text(title)
|
|
37
|
+
.fontSize(18)
|
|
38
|
+
.fontWeight(700)
|
|
39
|
+
.color("#111827")
|
|
40
|
+
.lineHeight(1.25)
|
|
41
|
+
.build() : null,
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
description ? Text(description)
|
|
45
|
+
.fontSize(14)
|
|
46
|
+
.color("#4B5563")
|
|
47
|
+
.lineHeight(1.5)
|
|
48
|
+
.className("line-clamp-2")
|
|
49
|
+
.build() : null,
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
(source || date) ? Box()
|
|
53
|
+
.className("flex items-center gap-2 mt-2")
|
|
54
|
+
.children([
|
|
55
|
+
Text(`${source ? source : ''}${source && date ? ' • ' : ''}${date ? date : ''}`)
|
|
56
|
+
.fontSize(11)
|
|
57
|
+
.fontWeight(600)
|
|
58
|
+
.color("#9CA3AF")
|
|
59
|
+
.textTransform("uppercase")
|
|
60
|
+
.letterSpacing("0.05em")
|
|
61
|
+
.build()
|
|
62
|
+
])
|
|
63
|
+
.build() : null
|
|
64
|
+
])
|
|
65
|
+
.build()
|
|
66
|
+
])
|
|
67
|
+
.build();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
class ContentCardBuilder extends FiboBuilder {
|
|
71
|
+
private _image?: string;
|
|
72
|
+
private _title?: string;
|
|
73
|
+
private _description?: string;
|
|
74
|
+
private _date?: string;
|
|
75
|
+
private _source?: string;
|
|
76
|
+
|
|
77
|
+
image(url: string): this {
|
|
78
|
+
this._image = url;
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
title(text: string): this {
|
|
83
|
+
this._title = text;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
description(text: string): this {
|
|
88
|
+
this._description = text;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
date(text: string): this {
|
|
93
|
+
this._date = text;
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
source(text: string): this {
|
|
98
|
+
this._source = text;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
build(): ReactElement {
|
|
103
|
+
const props = {
|
|
104
|
+
image: this._image,
|
|
105
|
+
title: this._title,
|
|
106
|
+
description: this._description,
|
|
107
|
+
date: this._date,
|
|
108
|
+
source: this._source,
|
|
109
|
+
className: this.getClassName(),
|
|
110
|
+
style: this.getStyle(),
|
|
111
|
+
...this._props
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return React.createElement(ContentCardInner, props);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
export const ContentCard = createBuilder(ContentCardBuilder);
|
|
120
|
+
|
|
121
|
+
export interface ContentCardProps extends BaseProps {
|
|
122
|
+
image?: string;
|
|
123
|
+
title?: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
date?: string;
|
|
126
|
+
source?: string;
|
|
127
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { FiboBuilder, createBuilder } from '../../../core/builder';
|
|
3
|
+
import { BaseProps } from '../../../core/types';
|
|
4
|
+
import { Box } from '../../Box';
|
|
5
|
+
import { Text } from '../../../content/Text';
|
|
6
|
+
import { Row } from '../../../layout/Row';
|
|
7
|
+
import { Column } from '../../../layout/Column';
|
|
8
|
+
import { Spacer } from '../../../layout/Spacer';
|
|
9
|
+
import { Button } from '../../../interactive/Button';
|
|
10
|
+
import { Card } from '../../Card';
|
|
11
|
+
import { Avatar } from '../../../content/Avatar';
|
|
12
|
+
import { Icons } from '../../../core/icons';
|
|
13
|
+
|
|
14
|
+
const ProfileCardInner = React.memo((props: any) => {
|
|
15
|
+
const { banner, avatar, name, handle, stats, className, style, ...rest } = props;
|
|
16
|
+
|
|
17
|
+
return Card()
|
|
18
|
+
.style({
|
|
19
|
+
width: '100%',
|
|
20
|
+
borderRadius: '24px',
|
|
21
|
+
border: 'none',
|
|
22
|
+
boxShadow: '0 10px 40px -10px rgba(0,0,0,0.05)',
|
|
23
|
+
padding: '0',
|
|
24
|
+
overflow: 'hidden',
|
|
25
|
+
background: '#fff',
|
|
26
|
+
...style
|
|
27
|
+
})
|
|
28
|
+
.className(className)
|
|
29
|
+
.props(rest)
|
|
30
|
+
.children([
|
|
31
|
+
|
|
32
|
+
Box()
|
|
33
|
+
.style({ height: '100px', backgroundImage: `url(${banner})`, backgroundSize: 'cover', backgroundPosition: 'center' })
|
|
34
|
+
.build(),
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Column().padding(20).alignItems("center").style({ marginTop: '-50px' }).children([
|
|
38
|
+
|
|
39
|
+
Avatar()
|
|
40
|
+
.image(avatar)
|
|
41
|
+
.size(80)
|
|
42
|
+
.border('4px solid #fff')
|
|
43
|
+
.build(),
|
|
44
|
+
|
|
45
|
+
Spacer().height(12).build(),
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
Row().gap(6).alignItems("center").children([
|
|
49
|
+
Text(name).fontWeight(700).fontSize(18).color("#111827").build(),
|
|
50
|
+
Icons.Verify
|
|
51
|
+
]).build(),
|
|
52
|
+
|
|
53
|
+
Text(handle).fontSize(13).color("#6B7280").style({ marginTop: '4px' }).build(),
|
|
54
|
+
|
|
55
|
+
Spacer().height(16).build(),
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Button("+ Follow")
|
|
59
|
+
.variant("filled")
|
|
60
|
+
.shape("pill")
|
|
61
|
+
.shadow("soft")
|
|
62
|
+
.style({
|
|
63
|
+
backgroundColor: '#3B82F6',
|
|
64
|
+
color: '#fff',
|
|
65
|
+
padding: '8px 24px',
|
|
66
|
+
fontSize: '13px',
|
|
67
|
+
fontWeight: 600
|
|
68
|
+
})
|
|
69
|
+
.build(),
|
|
70
|
+
|
|
71
|
+
Spacer().height(24).build(),
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
Row().classNames(['w-full', 'border-t', 'border-gray-100', 'pt-4']).justifyContent("between").children([
|
|
75
|
+
Column().alignItems("center").gap(4).children([
|
|
76
|
+
Text(stats.items).fontWeight(700).fontSize(14).build(),
|
|
77
|
+
Text("Items").fontSize(11).color("#9CA3AF").build()
|
|
78
|
+
]).build(),
|
|
79
|
+
Column().alignItems("center").gap(4).children([
|
|
80
|
+
Text(stats.owners).fontWeight(700).fontSize(14).build(),
|
|
81
|
+
Text("Owners").fontSize(11).color("#9CA3AF").build()
|
|
82
|
+
]).build(),
|
|
83
|
+
Column().alignItems("center").gap(4).children([
|
|
84
|
+
Row().alignItems("center").gap(2).children([
|
|
85
|
+
Box().width(8).children(Icons.Eth).build(),
|
|
86
|
+
Text(stats.floor).fontWeight(700).fontSize(14).build(),
|
|
87
|
+
]).build(),
|
|
88
|
+
Text("Floor").fontSize(11).color("#9CA3AF").build()
|
|
89
|
+
]).build(),
|
|
90
|
+
]).build()
|
|
91
|
+
|
|
92
|
+
]).build()
|
|
93
|
+
]).build();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
class ProfileCardBuilder extends FiboBuilder {
|
|
97
|
+
private _banner: string = '';
|
|
98
|
+
private _avatar: string = '';
|
|
99
|
+
private _name: string = '';
|
|
100
|
+
private _handle: string = '';
|
|
101
|
+
private _stats: { items: string, owners: string, floor: string } = { items: '0', owners: '0', floor: '0' };
|
|
102
|
+
|
|
103
|
+
banner(url: string): this {
|
|
104
|
+
this._banner = url;
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
avatar(url: string): this {
|
|
109
|
+
this._avatar = url;
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
name(text: string): this {
|
|
114
|
+
this._name = text;
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
handle(text: string): this {
|
|
119
|
+
this._handle = text;
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
stats(stats: { items: string, owners: string, floor: string }): this {
|
|
124
|
+
this._stats = stats;
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
build(): ReactElement {
|
|
129
|
+
const props = {
|
|
130
|
+
banner: this._banner,
|
|
131
|
+
avatar: this._avatar,
|
|
132
|
+
name: this._name,
|
|
133
|
+
handle: this._handle,
|
|
134
|
+
stats: this._stats,
|
|
135
|
+
className: this.getClassName(),
|
|
136
|
+
style: this.getStyle(),
|
|
137
|
+
...this._props
|
|
138
|
+
};
|
|
139
|
+
return React.createElement(ProfileCardInner, props);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
export const ProfileCard = createBuilder(ProfileCardBuilder);
|
|
145
|
+
|
|
146
|
+
export interface ProfileCardProps extends BaseProps {
|
|
147
|
+
banner: string;
|
|
148
|
+
avatar: string;
|
|
149
|
+
name: string;
|
|
150
|
+
handle: string;
|
|
151
|
+
stats: { items: string, owners: string, floor: string };
|
|
152
|
+
}
|