Compare commits

...
Author SHA1 Message Date
jaredvu 4ec459bb5d Mobile friendly Toast: Collapse/Close 2023-11-20 17:02:42 -08:00
3 changed files with 16 additions and 11 deletions
+5 -9
View File
@@ -44,13 +44,6 @@ export const ComboboxMenu = <MenuItemValue extends string, MenuGroupValue extend
}: ComboboxMenuProps<MenuItemValue, MenuGroupValue>) => { }: ComboboxMenuProps<MenuItemValue, MenuGroupValue>) => {
const [highlightedCommand, setHighlightedCommand] = useState<MenuItemValue>(); const [highlightedCommand, setHighlightedCommand] = useState<MenuItemValue>();
const [searchValue, setSearchValue] = useState(''); const [searchValue, setSearchValue] = useState('');
// const inputRef = useRef<HTMLInputElement | null>(null);
// console.log({ commandValue: highlightedCommand });
// useEffect(() => {
// inputRef?.current?.focus();
// }, []);
return ( return (
<Styled.Command <Styled.Command
@@ -67,11 +60,14 @@ export const ComboboxMenu = <MenuItemValue extends string, MenuGroupValue extend
{withSearch && ( {withSearch && (
<Styled.Header $withStickyLayout={withStickyLayout}> <Styled.Header $withStickyLayout={withStickyLayout}>
<Styled.Input <Styled.Input
// ref={inputRef} /**
* Mobile Issue: Search Input will always trigger mobile keyboard drawer. There is no fix.
* https://github.com/pacocoursey/cmdk/issues/127
*/
autoFocus
type="search" type="search"
value={searchValue} value={searchValue}
onValueChange={setSearchValue} onValueChange={setSearchValue}
autoFocus
placeholder={inputPlaceholder} placeholder={inputPlaceholder}
/> />
</Styled.Header> </Styled.Header>
+6
View File
@@ -4,6 +4,7 @@ import { Root, Action, Close } from '@radix-ui/react-toast';
import { ButtonShape, ButtonSize } from '@/constants/buttons'; import { ButtonShape, ButtonSize } from '@/constants/buttons';
import { popoverMixins } from '@/styles/popoverMixins'; import { popoverMixins } from '@/styles/popoverMixins';
import { breakpoints } from '@/styles';
import { Notification, type NotificationProps } from '@/components/Notification'; import { Notification, type NotificationProps } from '@/components/Notification';
@@ -254,6 +255,11 @@ const $CloseButton = styled(IconButton)`
display: block; display: block;
z-index: 2; z-index: 2;
} }
@media ${breakpoints.mobile} {
display: block;
z-index: 2;
}
`; `;
const $Action = styled(Action)` const $Action = styled(Action)`
+5 -2
View File
@@ -75,7 +75,7 @@ export const NotificationsToastArea = ({ className }: StyleProps) => {
{notificationMap.map(({ notification, key, displayData }, idx) => ( {notificationMap.map(({ notification, key, displayData }, idx) => (
<StyledToast <StyledToast
key={key} key={key}
isStacked={!isMobile && shouldStackNotifications} isStacked={shouldStackNotifications}
isOpen={notification.status < NotificationStatus.Unseen} isOpen={notification.status < NotificationStatus.Unseen}
layer={notificationMap.length - 1 - idx} layer={notificationMap.length - 1 - idx}
notification={notification} notification={notification}
@@ -167,6 +167,9 @@ const StyledToggleButton = styled(ToggleButton)<{ isPressed: boolean }>`
} }
@media ${breakpoints.mobile} { @media ${breakpoints.mobile} {
display: none; display: flex;
left: calc(50% - 2rem);
--button-width: 4rem;
--button-height: 2rem;
} }
`; `;