Skip to content

Commit d62b581

Browse files
committed
temp - adding icom
1 parent ff1c398 commit d62b581

File tree

3 files changed

+32
-11
lines changed

3 files changed

+32
-11
lines changed

src/components/SimplePanel.tsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export const SimplePanel: React.FC<Props> = ({ options, data, width, height }) =
1919
fieldCategory,
2020
fieldMentionsPercent,
2121
fieldMentionsCount,
22+
icon,
23+
iconColor,
2224
} = options;
2325

2426
// Handle no data case
@@ -45,6 +47,8 @@ export const SimplePanel: React.FC<Props> = ({ options, data, width, height }) =
4547
socialCount: get(socialVoicesCount),
4648
languages: get(fieldLanguage),
4749
languagesPercent: get(fieldLanguagePercent),
50+
icon: get(icon),
51+
iconColor: get(iconColor),
4852
};
4953
});
5054

@@ -128,20 +132,31 @@ export const SimplePanel: React.FC<Props> = ({ options, data, width, height }) =
128132
background: 'white',
129133
}}
130134
>
131-
{/* <div
135+
<div
132136
style={{
133137
width: 40,
134138
height: 40,
135139
borderRadius: '50%',
136-
background: '#E7F0FF',
140+
background: row.iconColor ?? 'blue',
137141
display: 'flex',
138142
alignItems: 'center',
139143
justifyContent: 'center',
140-
fontSize: 20,
141144
}}
142-
>
143-
{row.mentionsCount ?? '⭐'}
144-
</div> */}
145+
>
146+
{row.icon?.startsWith('http') ? (
147+
<img
148+
src={row.icon}
149+
alt=""
150+
style={{
151+
width: 20,
152+
height: 20,
153+
objectFit: 'contain',
154+
}}
155+
/>
156+
) : (
157+
row.icon ?? '⭐'
158+
)}
159+
</div>
145160
<div
146161
style={{
147162
marginTop: 8,

src/module.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@ export const plugin = new PanelPlugin<SimpleOptions>(SimplePanel).setPanelOption
4545
name: 'Language Percentage',
4646
description: 'Select the language percentage field',
4747
})
48-
.addColorPicker({
49-
path: 'barColor',
50-
name: 'Bar Color',
51-
defaultValue: 'green',
48+
.addFieldNamePicker({
49+
path: 'iconColor',
50+
name: 'Icon Color Field',
51+
description: 'Select icon color field'
52+
})
53+
.addFieldNamePicker({
54+
path: 'icon',
55+
name: 'Icon Type',
56+
description: 'Select icon type'
5257
})
5358
.addBooleanSwitch({
5459
path: 'showNumbering',

src/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export interface SimpleOptions {
99
fieldMentionsCount?: string;
1010
fieldLanguage?: string;
1111
fieldLanguagePercent?: string;
12-
barColor: string;
12+
iconColor?: string;
1313
showNumbering?: boolean;
1414
decimalPlaces?: number;
15+
icon?: string
1516
}

0 commit comments

Comments
 (0)