-
Notifications
You must be signed in to change notification settings - Fork 183
Mitra/Reusable hero banner #4135
Mitra/Reusable hero banner #4135
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
β‘οΈ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deriv-com-git-fork-mitra-deriv-reusable-hero-banner.binary.sx/ |
Kudos, SonarCloud Quality Gate passed!Β Β
|
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.
LGTM
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.
@mitra-deriv Just a suggestion, instead of derivez-logo.svg
, It's better to have the icon and the text logo as separate files, So later in the code, if needed we can use them separately or put them together with the code, So we wonβt need to add a new asset again in the future if we need the logo.
type TProps = { | ||
color?: string | ||
angle?: number | ||
src?: string |
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.
@mitra-deriv src
is not used anywhere, It's only in the type, Maybe we can remove it? π€
color?: string | ||
angle?: number | ||
src?: string | ||
children?: ReactNode |
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.
children?: ReactNode |
@mitra-deriv Instead use React.PropsWithChildren
generic.
` | ||
const ShapeStyle = styled.div<Pick<TProps, 'angle'>>` |
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.
` | |
const ShapeStyle = styled.div<Pick<TProps, 'angle'>>` | |
` | |
const ShapeStyle = styled.div<Pick<TProps, 'angle'>>` |
` | ||
const BackgroundStyle = styled.div<Pick<TProps, 'color'>>` |
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.
` | |
const BackgroundStyle = styled.div<Pick<TProps, 'color'>>` | |
` | |
const BackgroundStyle = styled.div<Pick<TProps, 'color'>>` |
Just some spacing between variables for better readability ππ»
return ( | ||
<ContainerStyle> | ||
<ShapeStyle angle={angle}> | ||
<BackgroundStyle color={color}></BackgroundStyle> |
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.
<BackgroundStyle color={color}></BackgroundStyle> | |
<BackgroundStyle color={color} /> |
` | ||
const ContentWrapperStyle = styled.div` |
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.
` | |
const ContentWrapperStyle = styled.div` | |
` | |
const ContentWrapperStyle = styled.div` |
` | ||
const HeroImageWrapper = styled.div` |
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.
` | |
const HeroImageWrapper = styled.div` | |
` | |
const HeroImageWrapper = styled.div` |
} | ||
` | ||
|
||
const Hero = () => { |
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.
const Hero = () => { | |
const Hero: React.FC = () => { |
const { is_mobile } = useBreakpoints() | ||
return ( |
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.
const { is_mobile } = useBreakpoints() | |
return ( | |
const { is_mobile } = useBreakpoints() | |
return ( |
<BackgroundStyle> | ||
<ContentWrapperStyle> | ||
<Content> | ||
<img width="237px" height="64px" src={DerivEZLogo} /> |
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.
@mitra-deriv Maybe we can create a reusable component for platform logos since they will be used in many places, As I mentioned in the assets we can have the logo and text logo separately, and then in this component, you can put them together, and use it everywhere, Something like the following:
type TProps = {
platform: 'deriv_ez' | 'deriv_go' | 'deriv_p2p' | ...
visibility?: 'both' | 'icon' | 'text'
size?: 'small' | 'medium' | 'large'
}
const PlatformLogo: React.FC<TProps> = ({ platform, visibility = 'both', size = 'medium' }) => ...
<PlatformLogo platform="deriv_ez" />
<PlatformLogo platform="deriv_p2p" visibility="icon" />
<PlatformLogo platform="deriv_go" visibility="text" size="large" />
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.
@farzin-deriv Thanks for the time and Reviewing the PR , I will resolve them in another branch and mark the conversations as resolved once it is done π πΉ
About the platforms logos just to be sure I got your point correctly, You mean we create a component which accepts the icon
(the red one) + text
(which here is deriv ez ) ?
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.
Not accepting icon and text as props, The component will handle it internally. Let's have a talk when you have time so I can explain it ππ»
Changes:
Co-authored-by: @farzin-deriv
Type of change