forked from argentlabs/argent-x
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request argentlabs#1947 from argentlabs/feature/dappland-b…
…anner BLO-861 dappland-banner
- Loading branch information
Showing
13 changed files
with
241 additions
and
4 deletions.
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
packages/extension/src/ui/features/accountTokens/dappland/banner.state.ts
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,15 @@ | ||
import create from "zustand" | ||
import { persist } from "zustand/middleware" | ||
|
||
export interface DapplandBannerState { | ||
hasSeenBanner: boolean | ||
} | ||
|
||
export const useDapplandBanner = create<DapplandBannerState>( | ||
persist( | ||
(_set, _get) => ({ | ||
hasSeenBanner: false, | ||
}), | ||
{ name: "hasSeenDapplandBanner" }, | ||
), | ||
) |
28 changes: 28 additions & 0 deletions
28
packages/extension/src/ui/features/settings/DapplandFooter.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,28 @@ | ||
import { Button, P3 } from "@argent/ui" | ||
import { SimpleGrid, VStack } from "@chakra-ui/react" | ||
import { FC } from "react" | ||
|
||
import { DapplandIcon } from "./assets/DapplandIcon" | ||
|
||
const DapplandFooter: FC = () => ( | ||
<VStack mt={4} borderTop="solid 1px" borderTopColor="border"> | ||
<P3 color="neutrals.400" pt="6"> | ||
Discover Starknet dapps: | ||
</P3> | ||
<SimpleGrid columns={1} gap="2" w="100%" py={4}> | ||
<Button | ||
as={"a"} | ||
size="sm" | ||
rounded={"lg"} | ||
leftIcon={<DapplandIcon />} | ||
href="https://www.dappland.com?utm_source=argent&utm_medium=extension&utm_content=settings" | ||
title="Dappland" | ||
target="_blank" | ||
> | ||
Dappland | ||
</Button> | ||
</SimpleGrid> | ||
</VStack> | ||
) | ||
|
||
export { DapplandFooter } |
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
31 changes: 31 additions & 0 deletions
31
packages/extension/src/ui/features/settings/assets/DapplandIcon.tsx
Large diffs are not rendered by default.
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
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
22 changes: 22 additions & 0 deletions
22
packages/storybook/src/ui/components/DapplandBanner.stories.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,22 @@ | ||
import { DapplandBanner } from "@argent/ui" | ||
import dapplandBanner from "@argent/ui/assets/dapplandBannerBackground.png" | ||
import { action } from "@storybook/addon-actions" | ||
import { ComponentMeta, ComponentStory } from "@storybook/react" | ||
|
||
export default { | ||
title: "components/DapplandBanner", | ||
component: DapplandBanner, | ||
} as ComponentMeta<typeof DapplandBanner> | ||
|
||
const Template: ComponentStory<typeof DapplandBanner> = (props) => ( | ||
<DapplandBanner {...props}></DapplandBanner> | ||
) | ||
|
||
export const Default = Template.bind({}) | ||
Default.args = { | ||
title: "Discover", | ||
subTitle: "Starknet dapps", | ||
backgroundImageUrl: dapplandBanner, | ||
href: "https://www.dappland.com?utm_source=argent&utm_medium=extension&utm_content=banner", | ||
onClose: action("onClose"), | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,99 @@ | ||
import { Box } from "@chakra-ui/react" | ||
import { FC, MouseEventHandler } from "react" | ||
|
||
import { ButtonCell } from "./CellStack" | ||
import { CloseIcon } from "./icons" | ||
import { P3, P4 } from "./Typography" | ||
|
||
interface CloseButtonProps { | ||
onClick?: MouseEventHandler<HTMLDivElement> | ||
} | ||
|
||
interface DapplandBannerProps { | ||
href: string | ||
backgroundImageUrl: string | ||
title?: string | ||
subTitle?: string | ||
onClose?: () => void | ||
} | ||
|
||
const Scrim: FC = () => ( | ||
<Box | ||
position="absolute" | ||
top="0" | ||
left="0" | ||
right="0" | ||
bottom="0" | ||
background="linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%)" | ||
zIndex="0" | ||
/> | ||
) | ||
const CloseButton: FC<CloseButtonProps> = ({ ...props }) => ( | ||
<Box | ||
position="absolute" | ||
top="0" | ||
right="0" | ||
width="24px" | ||
height="24px" | ||
zIndex="1" | ||
background="black" | ||
color="white" | ||
borderRadius={"50%"} | ||
m={1} | ||
display="flex" | ||
justifyContent="center" | ||
alignItems="center" | ||
{...props} | ||
> | ||
<CloseIcon fontSize="xs" /> | ||
</Box> | ||
) | ||
|
||
export const DapplandBanner: FC<DapplandBannerProps> = ({ | ||
href, | ||
backgroundImageUrl, | ||
title = "Discover", | ||
subTitle = "Starknet dapps", | ||
onClose, | ||
}) => { | ||
return ( | ||
<ButtonCell | ||
width="100%" | ||
overflow="hidden" | ||
position={"relative"} | ||
rightIcon={null} | ||
bgColor="#DCCAC0" | ||
background={`url("${backgroundImageUrl}")`} | ||
backgroundSize="contain" | ||
backgroundPosition="right top" | ||
backgroundRepeat="no-repeat" | ||
as="a" | ||
title="Dappland" | ||
target="_blank" | ||
// reset hover styles | ||
_hover={{ | ||
background: `url("${backgroundImageUrl}")`, | ||
backgroundSize: "contain", | ||
backgroundPosition: "right top", | ||
backgroundRepeat: "no-repeat", | ||
bgColor: "#DCCAC0", | ||
}} | ||
href={href} | ||
> | ||
<Scrim /> | ||
<P3 zIndex="1" color="black" fontWeight="extrabold"> | ||
{title} | ||
</P3> | ||
<P4 zIndex="1" color="black" fontWeight="medium"> | ||
{subTitle} | ||
</P4> | ||
<CloseButton | ||
onClick={(e) => { | ||
e.preventDefault() | ||
e.stopPropagation() | ||
onClose?.() | ||
}} | ||
/> | ||
</ButtonCell> | ||
) | ||
} |
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