Skip to content

Commit

Permalink
Merge branch 'translation-new-homepage' of https://github.com/binary-…
Browse files Browse the repository at this point in the history
…com/deriv-com into translation-new-homepage
  • Loading branch information
mitra-deriv committed Jan 16, 2024
2 parents e8b8a00 + d56dcad commit f3dd574
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 66 deletions.
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"dependencies": {
"@artsy/fresnel": "^6.2.1",
"@builder.io/partytown": "^0.8.1",
"@deriv-com/blocks": "^0.70.0",
"@deriv-com/components": "^0.41.0",
"@deriv-com/blocks": "^0.74.0",
"@deriv-com/components": "^0.44.0",
"@deriv-com/hooks": "^0.10.0",
"@deriv-com/providers": "^0.10.0",
"@deriv-com/providers": "^0.11.0",
"@deriv/analytics": "^1.4.4",
"@deriv/deriv-api": "^1.0.13",
"@deriv/quill-design": "^1.3.2",
Expand Down
6 changes: 6 additions & 0 deletions src/features/pages/home/hero/award-images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ import clsx from 'clsx'
import { StaticImage } from 'gatsby-plugin-image'
import { hero_content_award_img } from './styles.module.scss'
import { localize } from 'components/localization'
import useRegion from 'components/hooks/use-region'
import { isEuDomain } from 'common/utility'

const HeroAwardImages = () => {
const { is_eu } = useRegion()

if (isEuDomain() || is_eu) return null

return (
<div className={clsx('flex pb-general-xl', hero_content_award_img)}>
<StaticImage
Expand Down
22 changes: 22 additions & 0 deletions src/features/pages/home/hero/description.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import { Text } from '@deriv/quill-design'
import clsx from 'clsx'
import { hero_content_text } from './styles.module.scss'
import useRegion from 'components/hooks/use-region'
import { Localize } from 'components/localization'
import { isEuDomain } from 'common/utility'

const Description = () => {
const { is_eu } = useRegion()
return isEuDomain() || is_eu ? (
<Text size="md" className={clsx('text-solid-slate-50 mt-general-md', hero_content_text)}>
<Localize translate_text="_t_Trade CFDs and Multipliers on 1500+ instruments, all in one place with 24/7 trading and 24/7 worldwide support._t_" />
</Text>
) : (
<Text size="md" className={clsx('text-solid-slate-50 mt-general-md', hero_content_text)}>
<Localize translate_text="_t_Trade CFDs and Options on 1500+ instruments, all in one place with 24/7 trading and 24/7 worldwide support._t_" />
</Text>
)
}

export default Description
33 changes: 33 additions & 0 deletions src/features/pages/home/hero/hero-image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react'
import { StaticImage } from 'gatsby-plugin-image'
import clsx from 'clsx'
import { hero_img_eu, hero_img } from './styles.module.scss'
import { isEuDomain } from 'common/utility'
import useRegion from 'components/hooks/use-region'

const HeroImage = () => {
const { is_eu } = useRegion()
return isEuDomain() || is_eu ? (
<div className={clsx('absolute inset-50 flex items-end -z-10', hero_img_eu)}>
<StaticImage
src="../../../../images/migration/home/home_hero_new_eu.png"
alt="hero image"
placeholder="none"
formats={['auto', 'webp']}
loading="eager"
/>
</div>
) : (
<div className={clsx('absolute inset-50 flex items-end -z-10', hero_img)}>
<StaticImage
src="../../../../images/migration/home/home_hero_new.png"
alt="hero image"
placeholder="none"
formats={['auto', 'webp']}
loading="eager"
/>
</div>
)
}

export default HeroImage
59 changes: 8 additions & 51 deletions src/features/pages/home/hero/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import React, { ReactNode } from 'react'
import { FluidContainer, Heading, Section, Text } from '@deriv/quill-design'
import { FluidContainer, Heading, Section } from '@deriv/quill-design'
import clsx from 'clsx'
import { StaticImage } from 'gatsby-plugin-image'
import {
hero_container,
hero_content,
hero_content_gradient,
hero_img,
hero_img_eu,
hero_content_text,
hero_content_btn,
} from './styles.module.scss'
import HeroAwardImages from './award-images'
import HeroImage from './hero-image'
import FloatingCta from './floating-cta'
import Description from './description'
import { Localize } from 'components/localization'
import useRegion from 'components/hooks/use-region'
import TradersHubCtaButton from 'features/components/molecules/traders-hub-cta-button'
import { useFloatingCtaContext } from 'features/contexts/floating-cta/cta.provider'
import { usePageLoaded } from 'components/hooks/use-page-loaded'

export interface HomeHeroProps {
children?: ReactNode
className?: string
}

const HomeHero: React.FC<HomeHeroProps> = () => {
const { is_eu } = useRegion()
const [is_mounted] = usePageLoaded()
const { ctaBottom, visibilityPercentage, entryRef } = useFloatingCtaContext()

return (
Expand All @@ -45,58 +44,16 @@ const HomeHero: React.FC<HomeHeroProps> = () => {
<Heading.H1 className="text-solid-slate-50 text-[34px] lg:text-heading-h1">
<Localize translate_text="_t_Trading for anyone. Anywhere. Anytime._t_" />
</Heading.H1>
{is_eu ? (
<Text
size="md"
className={clsx(
'text-solid-slate-50 mt-general-md',
hero_content_text,
)}
>
<Localize translate_text="_t_Trade CFDs and Multipliers on 1500+ instruments, all in one place with 24/7 trading and 24/7 worldwide support._t_" />
</Text>
) : (
<Text
size="md"
className={clsx(
'text-solid-slate-50 mt-general-md',
hero_content_text,
)}
>
<Localize translate_text="_t_Trade CFDs and Options on 1500+ instruments, all in one place with 24/7 trading and 24/7 worldwide support._t_" />
</Text>
)}
{is_mounted && <Description />}
<TradersHubCtaButton
className={clsx('mt-general-2xl', hero_content_btn)}
variant="primary"
colorStyle="coral"
ref={entryRef}
/>
</div>
{!is_eu && <HeroAwardImages />}
{is_eu ? (
<div
className={clsx('absolute inset-50 flex items-end -z-10', hero_img_eu)}
>
<StaticImage
src="../../../../images/migration/home/home_hero_new_eu.png"
alt="hero image"
placeholder="none"
formats={['auto', 'webp']}
loading="eager"
/>
</div>
) : (
<div className={clsx('absolute inset-50 flex items-end -z-10', hero_img)}>
<StaticImage
src="../../../../images/migration/home/home_hero_new.png"
alt="hero image"
placeholder="none"
formats={['auto', 'webp']}
loading="eager"
/>
</div>
)}
{is_mounted && <HeroAwardImages />}
{is_mounted && <HeroImage />}
</FluidContainer>
<div className={clsx('absolute -z-10 inset-50', hero_content_gradient)}></div>
</Section>
Expand Down

0 comments on commit f3dd574

Please sign in to comment.