Skip to content

Commit

Permalink
comments fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lendihop committed Dec 8, 2023
1 parent 84fb142 commit 78682ce
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 28 deletions.
4 changes: 3 additions & 1 deletion src/app/atoms/CleanButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import useTippy from 'lib/ui/useTippy';

type CleanButtonProps = HTMLAttributes<HTMLButtonElement> & {
bottomOffset?: string;
iconClassName?: string;
iconStyle?: React.CSSProperties;
};

const CleanButton: FC<CleanButtonProps> = ({
bottomOffset = '0.4rem',
className,
iconClassName,
style = {},
iconStyle = {},
...rest
Expand Down Expand Up @@ -48,7 +50,7 @@ const CleanButton: FC<CleanButtonProps> = ({
tabIndex={-1}
{...rest}
>
<CloseIcon className="w-auto h-4 stroke-current" style={iconStyle} />
<CloseIcon className={classNames('w-auto h-4 stroke-current', iconClassName)} style={iconStyle} />
</button>
);
};
Expand Down
18 changes: 0 additions & 18 deletions src/app/hooks/use-current-os.ts

This file was deleted.

15 changes: 6 additions & 9 deletions src/app/layouts/PageLayout/Header/AccountDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import classNames from 'clsx';
import { Button } from 'app/atoms/Button';
import DropdownWrapper from 'app/atoms/DropdownWrapper';
import { openInFullPage, useAppEnv } from 'app/env';
import { useCurrentOs } from 'app/hooks/use-current-os';
import { ReactComponent as AddIcon } from 'app/icons/add.svg';
import { ReactComponent as DAppsIcon } from 'app/icons/apps-alt.svg';
import { ReactComponent as DownloadIcon } from 'app/icons/download.svg';
Expand All @@ -24,7 +23,8 @@ import { AccountItem } from './AccountItem';
import { ActionButtonProps, ActionButton } from './ActionButton';
import { AccountDropdownSelectors } from './selectors';

const COLOR_GRAY_600 = '#718096';
const isMacOS = /Mac OS/.test(navigator.userAgent);
const searchHotkey = ` (${isMacOS ? '⌘' : 'Ctrl + '}K)`;

type AccountDropdownProps = PopperRenderProps;

Expand All @@ -39,7 +39,6 @@ const AccountDropdown: FC<AccountDropdownProps> = ({ opened, setOpened }) => {
const account = useAccount();
const setAccountPkh = useSetAccountPkh();
const { assetName: gasTokenName } = useGasToken();
const os = useCurrentOs();

const [searchValue, setSearchValue] = useState('');
const [attractSelectedAccount, setAttractSelectedAccount] = useState(true);
Expand Down Expand Up @@ -137,8 +136,6 @@ const AccountDropdown: FC<AccountDropdownProps> = ({ opened, setOpened }) => {
[appEnv.fullPage, closeDropdown, handleMaximiseViewClick]
);

const searchHotkey = useMemo(() => ` (${os === 'mac' ? '⌘' : 'Ctrl + '}K)`, [os]);

useEffect(() => {
if (searchValue) setAttractSelectedAccount(false);
else if (!opened) setAttractSelectedAccount(true);
Expand Down Expand Up @@ -194,11 +191,11 @@ const AccountDropdown: FC<AccountDropdownProps> = ({ opened, setOpened }) => {
'text-gray-500 placeholder-gray-600 text-sm leading-tight'
)}
placeholder={t('searchAccount', [searchHotkey])}
searchIconClassName="h-5 w-auto"
searchIconClassName="h-5 w-auto text-gray-600 stroke-current"
searchIconWrapperClassName="px-2"
cleanButtonStyle={{ backgroundColor: 'transparent', borderColor: COLOR_GRAY_600 }}
cleanButtonIconStyle={{ stroke: COLOR_GRAY_600 }}
searchIconStyle={{ stroke: COLOR_GRAY_600 }}
cleanButtonClassName="border-gray-600"
cleanButtonIconClassName="text-gray-600 stroke-current"
cleanButtonStyle={{ backgroundColor: 'transparent' }}
onValueChange={setSearchValue}
/>

Expand Down
3 changes: 3 additions & 0 deletions src/app/templates/SearchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface SearchFieldProps extends InputHTMLAttributes<HTMLInputElement>,
searchIconClassName?: string;
searchIconWrapperClassName?: string;
cleanButtonClassName?: string;
cleanButtonIconClassName?: string;
searchIconStyle?: React.CSSProperties;
cleanButtonStyle?: React.CSSProperties;
cleanButtonIconStyle?: React.CSSProperties;
Expand All @@ -29,6 +30,7 @@ const SearchField: FC<SearchFieldProps> = ({
searchIconWrapperClassName,
cleanButtonClassName,
searchIconStyle,
cleanButtonIconClassName,
cleanButtonStyle,
cleanButtonIconStyle,
testID,
Expand Down Expand Up @@ -72,6 +74,7 @@ const SearchField: FC<SearchFieldProps> = ({
<CleanButton
bottomOffset={bottomOffset}
className={cleanButtonClassName}
iconClassName={cleanButtonIconClassName}
style={cleanButtonStyle}
iconStyle={cleanButtonIconStyle}
onClick={handleClean}
Expand Down

0 comments on commit 78682ce

Please sign in to comment.