Skip to content

Commit 4330cb8

Browse files
committed
proper aligning of icon
1 parent d62b581 commit 4330cb8

File tree

1 file changed

+73
-54
lines changed

1 file changed

+73
-54
lines changed

src/components/SimplePanel.tsx

Lines changed: 73 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const SimplePanel: React.FC<Props> = ({ options, data, width, height }) =
9090
display: 'flex',
9191
flexDirection: width < 300 ? 'column' : 'row',
9292
justifyContent: 'space-between',
93-
alignItems: 'flex-start',
93+
alignItems: 'center',
9494
gap: 24,
9595
marginBottom: 20,
9696
marginRight: 24,
@@ -132,16 +132,28 @@ export const SimplePanel: React.FC<Props> = ({ options, data, width, height }) =
132132
background: 'white',
133133
}}
134134
>
135-
<div
135+
{/* row wrapper for icon and details */}
136+
<div
136137
style={{
137-
width: 40,
138-
height: 40,
139-
borderRadius: '50%',
140-
background: row.iconColor ?? 'blue',
141138
display: 'flex',
139+
flexDirection: width < 300 ? 'column' : 'row',
142140
alignItems: 'center',
143-
justifyContent: 'center',
141+
gap: 12,
144142
}}
143+
>
144+
<div
145+
style={{
146+
minWidth: 40,
147+
minHeight: 40,
148+
width: 40,
149+
height: 40,
150+
borderRadius: '50%',
151+
background: row.iconColor ?? '#ddd',
152+
display: 'flex',
153+
alignItems: 'center',
154+
justifyContent: 'center',
155+
flexShrink: 0,
156+
}}
145157
>
146158
{row.icon?.startsWith('http') ? (
147159
<img
@@ -157,56 +169,63 @@ export const SimplePanel: React.FC<Props> = ({ options, data, width, height }) =
157169
row.icon ?? '⭐'
158170
)}
159171
</div>
160-
<div
161-
style={{
162-
marginTop: 8,
163-
fontSize: 12,
164-
fontWeight: 500,
165-
display: 'flex',
166-
flexDirection: width < 300 ? 'column' : 'row',
167-
justifyContent: 'space-between',
168-
169-
}}
170-
>
171-
<h3
172-
style={{
173-
margin: 0,
174-
fontSize: 16,
175-
fontWeight: 'bold',
176-
overflowWrap: 'break-word',
177-
}}
178-
>
179-
{options.showNumbering ? `${i + 1}. ` : ''}{row.category ?? 'category'}
180-
</h3>
181172

182-
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap'}}>
183-
<div
184-
style={{
185-
padding: '2px 12px',
186-
background: '#F4F4F4',
187-
borderRadius: 20,
188-
fontSize: 14,
189-
display: 'flex',
190-
alignItems: 'center',
191-
justifyContent: 'center',
192-
}}>
193-
{Number(row.mentionsPercent ?? '0').toFixed(options.decimalPlaces ?? 1)}%
173+
<div style={{ flex: 1 }}>
174+
{/* category and percentage pill row */}
175+
<div
176+
style={{
177+
display: 'flex',
178+
flexDirection: width < 300 ? 'column' : 'row',
179+
justifyContent: 'space-between',
180+
alignItems: width < 300 ? 'center' : 'center',
181+
gap: 8,
182+
}}
183+
>
184+
<h3
185+
style={{
186+
margin: 0,
187+
fontSize: 16,
188+
fontWeight: 'bold',
189+
overflowWrap: 'break-word',
190+
}}
191+
>
192+
{options.showNumbering ? `${i + 1}. ` : ''}
193+
{row.category ?? 'category'}
194+
</h3>
195+
196+
<div
197+
style={{
198+
padding: '2px 12px',
199+
background: '#F4F4F4',
200+
borderRadius: 20,
201+
fontSize: 14,
202+
display: 'flex',
203+
alignItems: 'center',
204+
justifyContent: 'center',
205+
}}
206+
>
207+
{Number(row.mentionsPercent ?? '0').toFixed(
208+
options.decimalPlaces ?? 1
209+
)}
210+
%
211+
</div>
194212
</div>
195-
</div>
196-
197-
</div>
198213

199-
<p
200-
style={{
201-
margin: 0,
202-
fontSize: 14,
203-
color: '#444',
204-
wordWrap: 'break-word',
205-
}}
206-
>
207-
<strong>{row.mentionsCount ?? '0'} posts </strong>
208-
</p>
209-
</div>
214+
{/* posts count row */}
215+
<p
216+
style={{
217+
margin: 0,
218+
marginTop: 6,
219+
fontSize: 14,
220+
color: '#444',
221+
wordWrap: 'break-word',
222+
}}
223+
>
224+
<strong>{row.mentionsCount ?? '0'} posts</strong>
225+
</p>
226+
</div>
227+
</div>
228+
</div>
210229
))}
211230

212231
<h2 style={{ marginTop: 20, marginBottom: 16, fontSize: 18, fontWeight: 'bold' }}>Language Distribution</h2>

0 commit comments

Comments
 (0)