Skip to content

Commit a087e5f

Browse files
authored
fix text overflow in social media link
1 parent a64a0c0 commit a087e5f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

components/preview/Preview.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ const Preview = () => {
149149
target="_blank"
150150
rel="noreferrer"
151151
className="inline-flex items-center gap-1 social-media"
152+
// Prevent text overflowing, If the socialMedia.link string is longer than 32 characters, apply the wordWrap and display styles to this <a> tag.
153+
// wordWrap: "break-word" breaks the text onto the next line if it's too long,
154+
// display: "inline-block" is necessary for wordWrap to work on an inline element like <a>.
155+
style={socialMedia.link.length > 32 ? { wordWrap: "break-word", display: "inline-block" } : {}}
152156
>
153157
{icons.map((icon, index) => {
154158
if (icon.name === socialMedia.socialMedia.toLowerCase()) {

0 commit comments

Comments
 (0)