Skip to content

Commit

Permalink
Merge pull request #349 from EscolaLMS/feature/isMobileDevice
Browse files Browse the repository at this point in the history
for ios mobile safe area
  • Loading branch information
victazzz committed Mar 29, 2024
2 parents 53bfb5b + 2e16e19 commit f5bc1c8
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/components/molecules/Navigation/Navigation.tsx
Expand Up @@ -100,15 +100,20 @@ export interface NavigationProps extends ExtendableStyledComponent {
notification?: ReactNode;
cart?: ReactNode;
profile?: ReactNode;
isMobileDevice?: boolean;
}

const GlobalStyle = createGlobalStyle`
const GlobalStyle = createGlobalStyle<{ $isMobileDevice: boolean }>`
.custom-drawer-wrapper {
@media (max-width: 530px) {
width: 90% !important;
}
.drawer-header {
padding-top: ${({ $isMobileDevice }) => $isMobileDevice && "100px"};
}
}
svg {
transition: opacity 0.2s ease-in-out;
Expand Down Expand Up @@ -243,7 +248,14 @@ const IconsHeaderMobileWrapper = styled.div`
`;

export const Navigation: React.FC<NavigationProps> = (props) => {
const { mobile, logo, menuItems, search, className = "" } = props;
const {
mobile,
logo,
menuItems,
search,
className = "",
isMobileDevice,
} = props;
const [mobileMenuOpen, setMobileMenuOpen] = useState<boolean>(false);
const [drawerSubmenuHistory, setDrawerSubmenuHistory] =
useState<DrawerSubmenuHistory>({});
Expand Down Expand Up @@ -341,7 +353,7 @@ export const Navigation: React.FC<NavigationProps> = (props) => {
<>
{mobile ? (
<StyledNavigation className={`wellms-component ${className}`}>
<GlobalStyle />
<GlobalStyle $isMobileDevice={isMobileDevice} />
<div className="header">
{React.isValidElement(logo) ? (
<React.Fragment>{logo}</React.Fragment>
Expand Down

0 comments on commit f5bc1c8

Please sign in to comment.