wip: new PhoneCountryCode Select
This commit is contained in:
committed by
Michael Zetterberg
parent
5f12dedb50
commit
79e669020a
@@ -10,6 +10,8 @@ import SpecialRequests from "@/components/HotelReservation/EnterDetails/Details/
|
||||
import CountrySelect from "@/components/TempDesignSystem/Form/Country"
|
||||
import Input from "@/components/TempDesignSystem/Form/Input"
|
||||
import Phone from "@/components/TempDesignSystem/Form/Phone"
|
||||
import PhoneCountryCode from "@/components/TempDesignSystem/Form/Phone/CountryCode"
|
||||
import PhoneNumber from "@/components/TempDesignSystem/Form/Phone/Number"
|
||||
import Footnote from "@/components/TempDesignSystem/Text/Footnote"
|
||||
import { useRoomContext } from "@/contexts/Details/Room"
|
||||
|
||||
@@ -159,6 +161,10 @@ export default function Details({ user }: DetailsProps) {
|
||||
readOnly={!!user}
|
||||
registerOptions={{ required: true, onBlur: updateDetailsStore }}
|
||||
/>
|
||||
<div>
|
||||
<PhoneCountryCode />
|
||||
<PhoneNumber />
|
||||
</div>
|
||||
{user ? null : (
|
||||
<div className={styles.fullWidth}>
|
||||
<Signup
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { Select } from "@scandic-hotels/design-system/Select"
|
||||
|
||||
import { countryPhoneCodes } from "@/constants/countryPhoneCodes"
|
||||
|
||||
export default function PhoneCountryCode() {
|
||||
const intl = useIntl()
|
||||
const countries = Object.entries(countryPhoneCodes).map(
|
||||
([countryName, countryCode]) => ({
|
||||
label: countryName,
|
||||
value: countryCode,
|
||||
})
|
||||
)
|
||||
console.log("length: ", countries.length)
|
||||
return (
|
||||
<Select
|
||||
name="phoneCountryCode"
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Country code",
|
||||
})}
|
||||
items={countries}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import Input from "@/components/TempDesignSystem/Form/Input"
|
||||
|
||||
export default function PhoneNumber() {
|
||||
const intl = useIntl()
|
||||
return (
|
||||
<Input
|
||||
label={intl.formatMessage({
|
||||
defaultMessage: "Phone number",
|
||||
})}
|
||||
name="phoneNumber"
|
||||
type="tel"
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user