Skip to content

Commit

Permalink
refactor(components): upgrade banner notification from js to tsx
Browse files Browse the repository at this point in the history
add typed props and style for the banner notification and switch from
js file to typescript react component

Refs: ethereum#6392
  • Loading branch information
Mousticke committed Jun 2, 2022
1 parent 207b078 commit 638aff7
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import React from "react"
import styled from "styled-components"

const Banner = styled.div`
export interface IStyledBanner {
shouldShow: boolean
}

export interface IProps {
shouldShow?: boolean
className?: string
}

const Banner = styled.div<IStyledBanner>`
display: ${(props) => (props.shouldShow ? `flex` : `none`)};
width: 100%;
background-color: ${(props) => props.theme.colors.primary};
Expand All @@ -18,7 +27,11 @@ const Banner = styled.div`
}
`

const BannerNotification = ({ children, className, shouldShow }) => (
const BannerNotification: React.FC<IProps> = ({
children,
className,
shouldShow = false,
}) => (
<Banner shouldShow={shouldShow} className={className}>
{children}
</Banner>
Expand Down

0 comments on commit 638aff7

Please sign in to comment.