oneslash-design-system 1.1.5 → 1.1.6
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/components/button.tsx +21 -3
- package/components/modal.tsx +11 -10
- package/package.json +1 -1
package/components/button.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import UserImage from './userImage';
|
|
3
4
|
|
|
4
5
|
interface ButtonProps{
|
|
5
6
|
size: 'small' | 'medium' | 'large';
|
|
@@ -7,6 +8,8 @@ interface ButtonProps{
|
|
|
7
8
|
state: 'enabled' | 'hovered' | 'focused' | 'disabled';
|
|
8
9
|
label: string;
|
|
9
10
|
decoIcon?: string;
|
|
11
|
+
userHandle?: string;
|
|
12
|
+
userImgUrl?: string;
|
|
10
13
|
actionIcon?: string;
|
|
11
14
|
onClickButton?: any;
|
|
12
15
|
onClickActionIcon?: () => void;
|
|
@@ -20,6 +23,8 @@ export default function Button({
|
|
|
20
23
|
state,
|
|
21
24
|
label,
|
|
22
25
|
decoIcon,
|
|
26
|
+
userHandle,
|
|
27
|
+
userImgUrl,
|
|
23
28
|
actionIcon,
|
|
24
29
|
onClickButton,
|
|
25
30
|
onClickActionIcon,
|
|
@@ -108,12 +113,25 @@ export default function Button({
|
|
|
108
113
|
onMouseLeave={() => { if (state !== 'disabled') setIsHovered(false); }}
|
|
109
114
|
onClick={onClickButton} // Button click action
|
|
110
115
|
>
|
|
111
|
-
{
|
|
116
|
+
{/* left icon or userImage */}
|
|
117
|
+
<div className="flex items-center space-x-2">
|
|
118
|
+
{/* Render dynamic icon if available */}
|
|
119
|
+
{IconLeft && (
|
|
112
120
|
<IconLeft className={sizeIcon} />
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
{/* Render UserImage if userImgUrl or userHandle is provided */}
|
|
124
|
+
{(userImgUrl || userHandle) && (
|
|
125
|
+
<UserImage userHandle={userHandle || ''} userImgUrl={userImgUrl} />
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
{/* label */}
|
|
130
|
+
<div className="flex-1 whitespace-nowrap overflow-hidden truncate px-2 text-left">
|
|
115
131
|
{label}
|
|
116
132
|
</div>
|
|
133
|
+
|
|
134
|
+
{/* right icon */}
|
|
117
135
|
{IconRight && (
|
|
118
136
|
<div onClick={onClickActionIcon} className="cursor-pointer">
|
|
119
137
|
<IconRight className={sizeIcon} />
|
package/components/modal.tsx
CHANGED
|
@@ -41,10 +41,10 @@ export default function Modal({
|
|
|
41
41
|
};
|
|
42
42
|
}, [onClose]);
|
|
43
43
|
|
|
44
|
-
//
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
// Define dimensions based on size
|
|
45
|
+
const dimensions = size === 'large'
|
|
46
|
+
? { width: '1200px', height: '800px' }
|
|
47
|
+
: { width: '600px' };
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
return (
|
|
@@ -57,21 +57,22 @@ export default function Modal({
|
|
|
57
57
|
tabIndex={-1}
|
|
58
58
|
>
|
|
59
59
|
<div
|
|
60
|
-
className={`flex flex-col bg-light-background-default dark:bg-dark-background-default p-6 rounded-[8px] space-y-4 ${modalWidth}`}
|
|
61
60
|
style={{
|
|
62
|
-
maxWidth,
|
|
61
|
+
maxWidth: dimensions.width,
|
|
62
|
+
...(size === 'large' && { maxHeight: dimensions.height }),
|
|
63
63
|
width: 'calc(100vw - 64px)',
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
overflowY: 'auto',
|
|
64
|
+
height: size === 'large' ? 'calc(100vh - 64px)' : 'auto',
|
|
65
|
+
overflowY: size === 'large' ? 'auto' : 'visible',
|
|
67
66
|
}}
|
|
67
|
+
className={`flex flex-col bg-light-background-default dark:bg-dark-background-default p-6 rounded-[8px] space-y-4`}
|
|
68
|
+
|
|
68
69
|
>
|
|
69
70
|
{title && (
|
|
70
71
|
<h2 id="modal-title" className="text-h6">
|
|
71
72
|
{title}
|
|
72
73
|
</h2>
|
|
73
74
|
)}
|
|
74
|
-
<div className="
|
|
75
|
+
<div className="flex-grow overflow-auto">
|
|
75
76
|
{children}
|
|
76
77
|
</div>
|
|
77
78
|
{actions && (
|