Skip to content

Commit 00b117f

Browse files
committed
More ImageIcon options
1 parent fa6ad47 commit 00b117f

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@near-pagoda/ui",
3-
"version": "3.1.10",
3+
"version": "3.1.11",
44
"description": "A React component library that implements the official NEAR design system.",
55
"license": "MIT",
66
"repository": {

src/components/ImageIcon.module.scss

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.imageIcon {
2-
border-radius: 100%;
32
overflow: hidden;
43
flex-shrink: 0;
54
background: #fff;
@@ -13,8 +12,21 @@
1312
width: 100%;
1413
height: 100%;
1514
object-fit: cover;
16-
fill: #000 !important;
17-
stroke: #000 !important;
15+
}
16+
17+
&[data-rounded='true'] {
18+
border-radius: 100%;
19+
}
20+
21+
&[data-transparent='true'] {
22+
background: transparent;
23+
}
24+
25+
&:not([data-transparent='true']) {
26+
svg {
27+
fill: #000 !important;
28+
stroke: #000 !important;
29+
}
1830
}
1931

2032
&[data-size='2xs'] {
@@ -68,4 +80,8 @@
6880
transform: scale(1.15, 1.15);
6981
}
7082
}
83+
84+
&[data-no-padding='true'] {
85+
padding: 0 !important;
86+
}
7187
}

src/components/ImageIcon.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ type Props = {
88
className?: string;
99
fallbackIcon?: ReactNode;
1010
indicateParentClickable?: boolean;
11+
padding?: boolean;
12+
paddingFallbackIcon?: boolean;
13+
rounded?: boolean;
14+
transparent?: boolean;
1115
size?: ThemeIconSize;
1216
src: string | undefined;
1317
style?: CSSProperties;
@@ -18,6 +22,10 @@ export const ImageIcon = ({
1822
className = '',
1923
fallbackIcon,
2024
indicateParentClickable,
25+
padding = true,
26+
paddingFallbackIcon = true,
27+
rounded = true,
28+
transparent,
2129
size = 'm',
2230
src,
2331
...props
@@ -27,6 +35,9 @@ export const ImageIcon = ({
2735
className={`${s.imageIcon} ${className} image-icon`}
2836
data-parent-clickable={indicateParentClickable}
2937
data-size={size}
38+
data-no-padding={(!padding && !!src) || (!paddingFallbackIcon && !src)}
39+
data-rounded={rounded}
40+
data-transparent={transparent}
3041
{...props}
3142
>
3243
{src ? <img src={src} alt={alt} /> : fallbackIcon}

0 commit comments

Comments
 (0)