-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
5 changed files
with
177 additions
and
91 deletions.
There are no files selected for viewing
89 changes: 0 additions & 89 deletions
89
packages/frontend/components/FullPageModal/FullPageModal.tsx
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
packages/frontend/components/WhatsNewModal/Fall2024ReleaseModalContent.tsx
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,72 @@ | ||
import { | ||
Box, | ||
Button, | ||
ModalContent, | ||
ModalFooter, | ||
ModalHeader, | ||
Text, | ||
} from "@chakra-ui/react"; | ||
import { ModalBodyPagination } from "./ModalBodyPagination"; | ||
|
||
interface ModalContentProps { | ||
onClose: () => void; | ||
} | ||
|
||
export const Fall2024ReleaseModalContent: React.FC<ModalContentProps> = ({ | ||
onClose, | ||
}) => { | ||
const featurePages: React.ReactNode[] = [ | ||
<FeaturePage1 />, | ||
<FeaturePage2 />, | ||
<FeaturePage3 />, | ||
]; | ||
|
||
return ( | ||
<ModalContent> | ||
<ModalHeader | ||
color="primary.blue.dark.main" | ||
borderBottom="1px" | ||
borderColor="neutral.200" | ||
> | ||
<Text>Latest Release v26.09.24</Text> | ||
</ModalHeader> | ||
<ModalBodyPagination pages={featurePages} /> | ||
|
||
<ModalFooter alignContent="center" justifyContent="center"> | ||
<Button | ||
variant="solid" | ||
borderRadius="md" | ||
width="sm" | ||
colorScheme="red" | ||
onClick={onClose} | ||
> | ||
Looks Good! | ||
</Button> | ||
</ModalFooter> | ||
</ModalContent> | ||
); | ||
}; | ||
|
||
const FeaturePage1: React.FC = () => { | ||
return ( | ||
<Box> | ||
<Text>Feature 1</Text> | ||
</Box> | ||
); | ||
}; | ||
|
||
const FeaturePage2: React.FC = () => { | ||
return ( | ||
<Box> | ||
<Text>Feature 2</Text> | ||
</Box> | ||
); | ||
}; | ||
|
||
const FeaturePage3: React.FC = () => { | ||
return ( | ||
<Box> | ||
<Text>Feature 3</Text> | ||
</Box> | ||
); | ||
}; |
77 changes: 77 additions & 0 deletions
77
packages/frontend/components/WhatsNewModal/ModalBodyPagination.tsx
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,77 @@ | ||
import { ChevronLeftIcon, ChevronRightIcon } from "@chakra-ui/icons"; | ||
import { Box, IconButton, ModalBody, Text } from "@chakra-ui/react"; | ||
import { useState } from "react"; | ||
|
||
interface ModalBodyPaginationProps { | ||
pages: React.ReactNode[]; | ||
} | ||
|
||
export const ModalBodyPagination: React.FC<ModalBodyPaginationProps> = ({ | ||
pages, | ||
}) => { | ||
const [currentPageIndex, setCurrentPageIndex] = useState(0); | ||
|
||
const totalPages = pages.length; | ||
|
||
function goToNextPage() { | ||
setCurrentPageIndex((prev) => Math.min(prev + 1, totalPages)); | ||
} | ||
|
||
function goToPreviousPage() { | ||
setCurrentPageIndex((prev) => Math.max(prev - 1, 0)); | ||
} | ||
|
||
function setCurrentPage(index: number) { | ||
setCurrentPageIndex(index); | ||
} | ||
|
||
return ( | ||
<ModalBody justifyContent="center" alignContent="center"> | ||
{pages[currentPageIndex]} | ||
<Pagination | ||
goToPreviousPage={goToPreviousPage} | ||
goToNextPage={goToNextPage} | ||
currentPageIndex={currentPageIndex} | ||
totalPages={totalPages} | ||
/> | ||
</ModalBody> | ||
); | ||
}; | ||
|
||
interface PaginationProps { | ||
goToPreviousPage: () => void; | ||
goToNextPage: () => void; | ||
currentPageIndex: number; | ||
totalPages: number; | ||
} | ||
|
||
const Pagination: React.FC<PaginationProps> = ({ | ||
goToPreviousPage, | ||
goToNextPage, | ||
currentPageIndex, | ||
totalPages, | ||
}) => { | ||
return ( | ||
<Box display="flex" alignItems="center" justifyContent="center"> | ||
<IconButton | ||
colorScheme="primary.blue.dark.400" | ||
variant="ghost" | ||
icon={<ChevronLeftIcon />} | ||
onClick={goToPreviousPage} | ||
isDisabled={currentPageIndex === 0} | ||
aria-label="Previous page" | ||
/> | ||
<Text textColor="primary.blue.dark.400"> | ||
{currentPageIndex + 1} / {totalPages} | ||
</Text> | ||
<IconButton | ||
colorScheme="primary.blue.dark.400" | ||
variant="ghost" | ||
icon={<ChevronRightIcon />} | ||
onClick={goToNextPage} | ||
isDisabled={currentPageIndex >= totalPages - 1} | ||
aria-label="Next page" | ||
/> | ||
</Box> | ||
); | ||
}; |
21 changes: 21 additions & 0 deletions
21
packages/frontend/components/WhatsNewModal/WhatsNewModal.tsx
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,21 @@ | ||
import React from "react"; | ||
import { Modal, ModalOverlay } from "@chakra-ui/react"; | ||
|
||
interface WhatsNewModalProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
children: React.ReactNode; | ||
} | ||
|
||
export const WhatsNewModal: React.FC<WhatsNewModalProps> = ({ | ||
isOpen, | ||
onClose, | ||
children, | ||
}) => { | ||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose} size="4xl" isCentered> | ||
<ModalOverlay /> | ||
{children} | ||
</Modal> | ||
); | ||
}; |
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