-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02b8c72
commit 3c46179
Showing
6 changed files
with
73 additions
and
22 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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,19 @@ | ||
import { Box } from "@saleor/macaw-ui-next"; | ||
import React from "react"; | ||
|
||
interface ContainerProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
export const Container = ({ children }: ContainerProps) => { | ||
return ( | ||
<Box | ||
backgroundColor="warning1" | ||
paddingX={3} | ||
paddingY={0.5} | ||
display="flex" | ||
justifyContent="center" | ||
alignItems="center" | ||
>{children}</Box> | ||
) | ||
} |
This file contains 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 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,18 @@ | ||
import { Text } from "@saleor/macaw-ui-next"; | ||
import React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
import { Container } from "./Container"; | ||
|
||
export const YouAreOffline = () => { | ||
return ( | ||
<Container> | ||
<Text size={1} fontWeight="medium"> | ||
<FormattedMessage | ||
id="cLnkZn" | ||
defaultMessage="You are currently offline. Some features may not be available." | ||
description="You are currently offline. Some features may not be available." | ||
/> | ||
</Text> | ||
</Container> | ||
); | ||
}; |
This file contains 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,24 @@ | ||
import React from "react"; | ||
import { YouAreOffline } from "./YouAreOffline"; | ||
import { useRegisterSW } from "virtual:pwa-register/react"; | ||
import { NewVersionAvailable } from "./NewVersionAvailable"; | ||
|
||
export const TopWarning = () => { | ||
const { | ||
needRefresh: [needRefresh], | ||
offlineReady: [offlineReady], | ||
} = useRegisterSW(); | ||
|
||
|
||
if (offlineReady) { | ||
return <YouAreOffline /> | ||
} | ||
|
||
if (needRefresh) { | ||
return <NewVersionAvailable /> | ||
} | ||
|
||
return null | ||
}; | ||
|
||
|
This file contains 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