-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BLO-861 dappland-banner #1947
Merged
Merged
BLO-861 dappland-banner #1947
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably use title here |
||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be a more generic component ClickableImageBanner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's almost nothing tying it to DappLand