Skip to content

Commit 1f8e12f

Browse files
Merge pull request #7 from rizul11/master
Fix phone number and select country text visibility
2 parents 60d8909 + 986f6e1 commit 1f8e12f

File tree

3 files changed

+74
-23
lines changed

3 files changed

+74
-23
lines changed

package-lock.json

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/globals.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,54 @@
88
scroll-behavior: smooth;
99
box-sizing: border-box;
1010
}
11+
12+
@import 'tailwindcss/base';
13+
14+
/* Custom styles for the country select element */
15+
.my-custom-country-select {
16+
padding: 0.75rem 1rem;
17+
border: 2px solid #6B7280;
18+
border-radius: 0.5rem;
19+
background-color: #F3F4F6;
20+
color: #111827;
21+
font-size: 1rem;
22+
transition: border-color 0.2s ease;
23+
}
24+
25+
.my-custom-country-select:focus {
26+
border-color: #3B82F6;
27+
}
28+
29+
Custom styles for the input element
30+
.my-custom-input {
31+
padding: 0.75rem 1rem;
32+
border: 2px solid #6B7280;
33+
border-radius: 0.5rem;
34+
background-color: #F3F4F6;
35+
color: #111827;
36+
font-size: 1rem;
37+
transition: border-color 0.2s ease;
38+
}
39+
40+
.my-custom-input:focus {
41+
border-color: #3B82F6;
42+
}
43+
44+
.PhoneInputCountrySelect {
45+
position: absolute;
46+
top: 0;
47+
left: 0;
48+
height: 100%;
49+
width: 100%;
50+
z-index: 1;
51+
border: 0;
52+
opacity: 0;
53+
cursor: pointer;
54+
color: darkslategrey;
55+
}
56+
57+
.PhoneInputInput {
58+
flex: 1;
59+
min-width: 0;
60+
color: darkblue;
61+
}

src/app/page.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use client";
2+
23
import PhoneInput, { isValidPhoneNumber } from "react-phone-number-input";
34
import { useState } from "react";
45
import "react-phone-number-input/style.css"; // Import the CSS for PhoneInput
@@ -19,29 +20,36 @@ export default function Home() {
1920
};
2021

2122
return (
22-
<main className="w-screen h-screen bg-gray-800 text-gray-200 flex flex-col justify-center items-center">
23-
<h1 className="text-3xl font-semibold mb-4">QuickSend</h1>
24-
<div className="flex space-x-4 mb-4">
23+
<main className="bg-gradient-to-b from-indigo-900 to-gray-800 min-h-screen flex flex-col items-center justify-center text-white">
24+
<h1 className="text-4xl font-extrabold mb-8">QuickSend</h1>
25+
<div className="mb-8">
2526
<button
2627
className={`${
27-
messenger === "whatsapp" ? "bg-blue-500" : "bg-gray-400"
28-
} text-white px-4 py-2 rounded-md`}
28+
messenger === "whatsapp"
29+
? "bg-green-500"
30+
: "bg-gray-600 hover:bg-green-500"
31+
} text-white px-4 py-2 rounded-lg`}
2932
onClick={() => handleMessengerChange("whatsapp")}
3033
>
31-
Whatsapp
34+
WhatsApp
3235
</button>
3336
<button
3437
className={`${
35-
messenger === "telegram" ? "bg-blue-500" : "bg-gray-400"
36-
} text-white px-4 py-2 rounded-md`}
38+
messenger === "telegram"
39+
? "bg-blue-500"
40+
: "bg-gray-600 hover:bg-blue-500"
41+
} text-white px-4 py-2 rounded-lg ml-4`}
3742
onClick={() => handleMessengerChange("telegram")}
3843
>
3944
Telegram
4045
</button>
4146
</div>
42-
<div className="flex flex-col items-center">
47+
<div className="w-80">
4348
<PhoneInput
44-
className="p-2"
49+
classNames={{
50+
countrySelect: "my-custom-country-select",
51+
input: "my-custom-input",
52+
}}
4553
placeholder="Enter phone number"
4654
countrySelectProps={{ unicodeFlags: true }}
4755
value={value}
@@ -57,7 +65,11 @@ export default function Home() {
5765
defaultCountry="IN"
5866
/>
5967
<button
60-
className="bg-blue-500 text-white px-4 py-2 rounded-md mt-2"
68+
className={`${
69+
isValidPhoneNumber(value)
70+
? "bg-blue-500 hover:bg-blue-600"
71+
: "bg-gray-600"
72+
} text-white px-4 py-2 rounded-lg mt-4 w-full`}
6173
onClick={handleSendClick}
6274
disabled={!isValidPhoneNumber(value)}
6375
>

0 commit comments

Comments
 (0)