Skip to content

Commit

Permalink
feat: implement HeroImage
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhojang6 committed Mar 21, 2024
1 parent 89e609f commit 24461d0
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/docusaurus-playground/src/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
HeroTitle,
HeroDescription,
HeroActions,
HeroImage,
HeroAction,
CallToActionSection,
CallToActionButton,
Expand Down Expand Up @@ -38,6 +39,7 @@ import * as challengesData from '/generated/challenges.json'
</HeroAction>
</HeroActions>
</HeroInfo>
<HeroImage src="/hero/hero-image.png" alt="alt" />
</Hero>

<Box>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
@use '../../../css/utils';
@use '../../../css/lsd';

.mdx-hero {
--default-z-index: 1;
--hero-max-height: 1080px;

position: relative;
display: flex;
flex-direction: column;
height: calc(100vh - var(--ifm-navbar-height) - 8px);
max-height: var(--hero-max-height);
z-index: var(--default-z-index);

h1 {
@include lsd.typography('display4');
}
}

.mdx-hero--large {
Expand All @@ -25,3 +34,11 @@
.mdx-hero--bottom {
justify-content: flex-end;
}

@include utils.responsive('md', 'down') {
.mdx-hero {
h1 {
@include lsd.typography('h2');
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@use '../../../css/utils';

.mdx-hero-image {
--default-z-index: -1;
z-index: var(--default-z-index);

button {
display: none !important;
}

img {
position: absolute;
right: -300px;
top: 0;
}
}

@include utils.responsive('lg', 'down') {
.mdx-hero-image {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import clsx from 'clsx'
import React, { PropsWithChildren } from 'react'
import './HeroImage.scss'

export type HeroImageProps = PropsWithChildren<
React.HTMLAttributes<HTMLDivElement>
> & {
src: string
alt: string
}

export const HeroImage: React.FC<HeroImageProps> = ({
src,
alt,
className,
children,
...props
}) => {
return (
<>
<div className={clsx(className, 'mdx-hero-image')} {...(props as any)}>
<img src={src} alt={alt} className="mdx-hero-image__img" />
{children}
</div>
</>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './HeroImage'
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export * from './HeroInfo'
export * from './HeroModel'
export * from './HeroTitle'
export * from './HeroVideo'
export * from './HeroImage'
export * from './JobsPerDepartment'
export * from './LogoCarousel'
export * from './NewsletterSubscription'
Expand Down
14 changes: 14 additions & 0 deletions packages/logos-docusaurus-theme/src/client/css/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,16 @@ a code {
--ifm-navbar-item-padding-horizontal: 12px;
}

.mdx-page {
body {
overflow-x: hidden !important;
}

.navbar {
background-color: transparent;
}
}

.card,
.alert,
.theme-code-block {
Expand Down Expand Up @@ -458,6 +468,10 @@ small {
height: 40px;
}

a[class^='sidebarLogo_'] {
margin-left: -16px !important;
}

.header-github-link:hover {
opacity: 0.6;
}
Expand Down

0 comments on commit 24461d0

Please sign in to comment.