Skip to content

Commit 55f8493

Browse files
author
k.golikov
committed
User Info: add country flag
1 parent 8a30d0b commit 55f8493

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

src/pages/userInfoPage/UserInfoPage.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
.locationSkeleton {
2020
height: 22px !important;
21-
width: 165px;
21+
width: 190px;
2222
margin-top: 1px;
2323
}
2424

src/pages/userInfoPage/UserInfoPage.tsx

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,31 @@ const UserInfoPage: FunctionComponent = () => {
4545
<Skeleton.Input active className={styles.ipDataProviderSkeleton} />
4646
</>
4747
) : (
48-
<>
49-
<Text strong className={styles.ipAddress}>
50-
<Text strong>IP: </Text>
51-
<Text copyable>{userIpInfo?.ip}</Text>
52-
</Text>
53-
<Text>
54-
<Text strong>Location:</Text>
55-
<Text className="ms-1">
56-
{userIpInfo?.countryName}, {userIpInfo?.city}
48+
userIpInfo && (
49+
<>
50+
<Text strong className={styles.ipAddress}>
51+
<Text strong>IP: </Text>
52+
<Text copyable>{userIpInfo.ip}</Text>
5753
</Text>
58-
</Text>
59-
<Text type="secondary">
60-
The data is provided by{' '}
61-
<ExternalLink href="https://ipapi.co/">ipapi.co</ExternalLink>
62-
</Text>
63-
</>
54+
<Text className="d-flex align-items-center">
55+
<Text strong>Location:</Text>
56+
<img
57+
className="ms-2"
58+
src={`https://purecatamphetamine.github.io/country-flag-icons/3x2/${userIpInfo.country}.svg`}
59+
alt={userIpInfo.country}
60+
height={12}
61+
width={18}
62+
/>
63+
<Text className="ms-1">
64+
{userIpInfo.countryName}, {userIpInfo.city}
65+
</Text>
66+
</Text>
67+
<Text type="secondary">
68+
The data is provided by{' '}
69+
<ExternalLink href="https://ipapi.co/">ipapi.co</ExternalLink>
70+
</Text>
71+
</>
72+
)
6473
)}
6574
</Space>
6675
)}

0 commit comments

Comments
 (0)