x
This commit is contained in:
1 parent
f7ac94ca0d
commit
335f3b4f59
41 files changed
+809
-413
No files matched your search
@@ -78,11 +78,11 @@ export function ThaiAddressInput({ value, onChange }: ThaiAddressInputProps) {
|
||||
if (focusedField !== field || results.length === 0) return null;
|
||||
|
||||
return (
|
||||
<ul className="absolute z-50 w-full bg-spa-light border border-spa-stone/20 rounded-lg mt-1 max-h-60 overflow-y-auto shadow-xl">
|
||||
<ul className="absolute z-50 w-full bg-pop-bg border border-pop-black/20 rounded-lg mt-1 max-h-60 overflow-y-auto shadow-xl">
|
||||
{results.map((item, idx) => (
|
||||
<li
|
||||
key={`${item.district}-${item.amphoe}-${item.province}-${item.zipcode}-${idx}`}
|
||||
className="p-3 hover:bg-spa-sage/10 cursor-pointer text-xs text-pop-black border-b border-spa-stone/10 last:border-0"
|
||||
className="p-3 hover:bg-pop-black/5 cursor-pointer text-xs text-pop-black border-b border-pop-black/10 last:border-0"
|
||||
onMouseDown={(e) => {
|
||||
// use onMouseDown to prevent onBlur from firing before onClick
|
||||
e.preventDefault();
|
||||
@@ -99,7 +99,7 @@ export function ThaiAddressInput({ value, onChange }: ThaiAddressInputProps) {
|
||||
return (
|
||||
<div ref={containerRef} className="grid grid-cols-2 md:grid-cols-4 gap-4 w-full">
|
||||
<div className="space-y-1.5 relative">
|
||||
<label className="text-[10px] uppercase font-bold tracking-widest text-spa-stone/80">แขวง / ตำบล</label>
|
||||
<label className="text-[10px] uppercase font-bold tracking-widest text-pop-black/80">แขวง / ตำบล</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
@@ -107,13 +107,13 @@ export function ThaiAddressInput({ value, onChange }: ThaiAddressInputProps) {
|
||||
onChange={e => handleSearch(e.target.value, 'subdistrict')}
|
||||
onFocus={() => { setFocusedField('subdistrict'); handleSearch(value.subdistrict, 'subdistrict'); }}
|
||||
onBlur={() => setTimeout(() => { if (focusedField === 'subdistrict') setFocusedField(null); }, 200)}
|
||||
className="w-full bg-spa-light border border-spa-stone/20 rounded-lg p-2.5 text-xs text-pop-black focus:border-spa-forest outline-none transition-all"
|
||||
className="w-full bg-pop-bg border border-pop-black/20 rounded-lg p-2.5 text-xs text-pop-black focus:border-pop-black outline-none transition-all"
|
||||
/>
|
||||
{renderDropdown('subdistrict')}
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 relative">
|
||||
<label className="text-[10px] uppercase font-bold tracking-widest text-spa-stone/80">เขต / อำเภอ</label>
|
||||
<label className="text-[10px] uppercase font-bold tracking-widest text-pop-black/80">เขต / อำเภอ</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
@@ -121,13 +121,13 @@ export function ThaiAddressInput({ value, onChange }: ThaiAddressInputProps) {
|
||||
onChange={e => handleSearch(e.target.value, 'district')}
|
||||
onFocus={() => { setFocusedField('district'); handleSearch(value.district, 'district'); }}
|
||||
onBlur={() => setTimeout(() => { if (focusedField === 'district') setFocusedField(null); }, 200)}
|
||||
className="w-full bg-spa-light border border-spa-stone/20 rounded-lg p-2.5 text-xs text-pop-black focus:border-spa-forest outline-none transition-all"
|
||||
className="w-full bg-pop-bg border border-pop-black/20 rounded-lg p-2.5 text-xs text-pop-black focus:border-pop-black outline-none transition-all"
|
||||
/>
|
||||
{renderDropdown('district')}
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 relative">
|
||||
<label className="text-[10px] uppercase font-bold tracking-widest text-spa-stone/80">จังหวัด</label>
|
||||
<label className="text-[10px] uppercase font-bold tracking-widest text-pop-black/80">จังหวัด</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
@@ -135,13 +135,13 @@ export function ThaiAddressInput({ value, onChange }: ThaiAddressInputProps) {
|
||||
onChange={e => handleSearch(e.target.value, 'province')}
|
||||
onFocus={() => { setFocusedField('province'); handleSearch(value.province, 'province'); }}
|
||||
onBlur={() => setTimeout(() => { if (focusedField === 'province') setFocusedField(null); }, 200)}
|
||||
className="w-full bg-spa-light border border-spa-stone/20 rounded-lg p-2.5 text-xs text-pop-black focus:border-spa-forest outline-none transition-all"
|
||||
className="w-full bg-pop-bg border border-pop-black/20 rounded-lg p-2.5 text-xs text-pop-black focus:border-pop-black outline-none transition-all"
|
||||
/>
|
||||
{renderDropdown('province')}
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 relative">
|
||||
<label className="text-[10px] uppercase font-bold tracking-widest text-spa-stone/80">รหัสไปรษณีย์</label>
|
||||
<label className="text-[10px] uppercase font-bold tracking-widest text-pop-black/80">รหัสไปรษณีย์</label>
|
||||
<input
|
||||
type="text"
|
||||
required
|
||||
@@ -149,7 +149,7 @@ export function ThaiAddressInput({ value, onChange }: ThaiAddressInputProps) {
|
||||
onChange={e => handleSearch(e.target.value, 'zipcode')}
|
||||
onFocus={() => { setFocusedField('zipcode'); handleSearch(value.zipcode, 'zipcode'); }}
|
||||
onBlur={() => setTimeout(() => { if (focusedField === 'zipcode') setFocusedField(null); }, 200)}
|
||||
className="w-full bg-spa-light border border-spa-stone/20 rounded-lg p-2.5 text-xs text-pop-black focus:border-spa-forest outline-none transition-all"
|
||||
className="w-full bg-pop-bg border border-pop-black/20 rounded-lg p-2.5 text-xs text-pop-black focus:border-pop-black outline-none transition-all"
|
||||
/>
|
||||
{renderDropdown('zipcode')}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user