Skip to content

Commit 0a9f71f

Browse files
committed
chore: add PencilIcon component for edit button and enhance button styling in BaseUserProfile
1 parent 5693c30 commit 0a9f71f

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

packages/react/src/components/presentation/UserProfile/BaseUserProfile.tsx

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ const BaseUserProfile: FC<BaseUserProfileProps> = ({
8484
const [editedUser, setEditedUser] = useState(user);
8585
const [editingFields, setEditingFields] = useState<Record<string, boolean>>({});
8686

87+
const PencilIcon = () => (
88+
<svg
89+
width="16"
90+
height="16"
91+
viewBox="0 0 24 24"
92+
fill="none"
93+
stroke="currentColor"
94+
strokeWidth="2"
95+
strokeLinecap="round"
96+
strokeLinejoin="round"
97+
>
98+
<path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" />
99+
</svg>
100+
);
101+
87102
const toggleFieldEdit = useCallback((fieldName: string) => {
88103
setEditingFields(prev => ({
89104
...prev,
@@ -313,10 +328,21 @@ const BaseUserProfile: FC<BaseUserProfileProps> = ({
313328
</>
314329
) : (
315330
<button
316-
style={{...actionButtonStyle, backgroundColor: theme.colors.background.surface}}
331+
style={{
332+
...actionButtonStyle,
333+
backgroundColor: 'transparent',
334+
border: 'none',
335+
margin: 0,
336+
padding: theme.spacing.unit / 2 + 'px',
337+
color: theme.colors.text.secondary,
338+
'&:hover': {
339+
color: theme.colors.text.primary,
340+
},
341+
}}
317342
onClick={() => toggleFieldEdit(schema.name!)}
343+
title="Edit"
318344
>
319-
Edit
345+
<PencilIcon />
320346
</button>
321347
)}
322348
</div>
@@ -453,6 +479,7 @@ const useStyles = () => {
453479
borderBottom: 'none',
454480
} as CSSProperties,
455481
label: {
482+
fontSize: '0.875rem',
456483
fontWeight: 500,
457484
color: theme.colors.text.secondary,
458485
width: '120px',
@@ -462,10 +489,13 @@ const useStyles = () => {
462489
color: theme.colors.text.primary,
463490
flex: 1,
464491
overflow: 'hidden',
465-
wordBreak: 'break-word',
492+
textOverflow: 'ellipsis',
493+
whiteSpace: 'nowrap',
494+
maxWidth: 'calc(100% - 120px)', // Subtracting label width
466495
'& table': {
467496
backgroundColor: theme.colors.background,
468497
borderRadius: theme.borderRadius.small,
498+
whiteSpace: 'normal', // Allow tables to wrap
469499
},
470500
'& td': {
471501
borderColor: theme.colors.border,
@@ -479,4 +509,4 @@ const useStyles = () => {
479509
);
480510
};
481511

482-
export default BaseUserProfile;
512+
export default BaseUserProfile;

0 commit comments

Comments
 (0)