-
Notifications
You must be signed in to change notification settings - Fork 0
[_]: feat/add dropdown to select inxt domain #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xabg2
wants to merge
2
commits into
master
Choose a base branch
from
feature/dropdown-to-select-inxt-domain-when-setting-up-new-mail
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/features/identity-setup/components/SelectMailInput.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import { INTERNXT_EMAIL_DOMAINS } from '@/constants'; | ||
| import { Dropdown } from '@internxt/ui'; | ||
| import { CaretDownIcon, CaretUpIcon, CheckIcon } from '@phosphor-icons/react'; | ||
| import { useState } from 'react'; | ||
|
|
||
| export type Domain = (typeof INTERNXT_EMAIL_DOMAINS)[number]; | ||
|
|
||
| interface SelectMailInputProps { | ||
| value: string; | ||
| onChangeValue: (value: string) => void; | ||
| selectedDomain: Domain; | ||
| onChangeDomain: (domain: Domain) => void; | ||
| } | ||
|
|
||
| const SelectMailInput = ({ value, onChangeValue, selectedDomain, onChangeDomain }: SelectMailInputProps) => { | ||
| const [isFocused, setIsFocused] = useState(false); | ||
|
|
||
| const menuItems = INTERNXT_EMAIL_DOMAINS.map((domain) => ( | ||
| <button | ||
| key={domain} | ||
| className={`flex w-full items-center gap-1 py-1 ${domain === selectedDomain ? 'font-bold' : 'font-normal'} text-sm text-gray-100 hover:bg-gray-5`} | ||
| onClick={() => onChangeDomain(domain)} | ||
| > | ||
| <span className={'w-5 shrink-0 '}>{domain === selectedDomain && <CheckIcon size={16} weight="bold" />}</span> | ||
| {domain} | ||
| </button> | ||
| )); | ||
|
|
||
| return ( | ||
| <div | ||
| className={`relative flex h-11 w-full items-center rounded-lg border bg-surface transition-all duration-150 ${ | ||
| isFocused ? 'border-primary ring-3 ring-primary/10 dark:ring-primary/20' : 'border-gray-20 hover:border-gray-30' | ||
| }`} | ||
| > | ||
| <input | ||
| type="text" | ||
| autoComplete="off" | ||
| spellCheck="false" | ||
| className="h-full min-w-0 flex-1 bg-transparent pl-3 text-lg text-gray-100 outline-none placeholder:text-gray-40" | ||
| value={value} | ||
| onChange={(e) => onChangeValue(e.target.value)} | ||
| onFocus={() => setIsFocused(true)} | ||
| onBlur={() => setIsFocused(false)} | ||
| /> | ||
|
|
||
| <div className="flex flex-col z-10"> | ||
| <Dropdown | ||
| classButton="flex items-center gap-1 px-3 text-sm font-medium text-gray-60 hover:text-gray-80 transition-colors whitespace-nowrap" | ||
| classMenuItems="right-0 top-1 min-w-[160px] rounded-lg bg-surface shadow-subtle-hard text-gray-100 dark:bg-gray-5" | ||
| openDirection="right" | ||
| menuItems={menuItems} | ||
| > | ||
| {({ open }) => ( | ||
| <span className="flex items-center gap-1"> | ||
| {selectedDomain} | ||
| {open ? <CaretUpIcon weight="fill" size={12} /> : <CaretDownIcon weight="fill" size={12} />} | ||
| </span> | ||
| )} | ||
| </Dropdown> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default SelectMailInput; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.