-
Notifications
You must be signed in to change notification settings - Fork 9
[add] Hero Carousel component with Aurora Gradient style in Home page #72
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3b66c69
refactor(home): redesign hackathon top bar with aurora gradient style
dethan3 ed2cf15
refactor: rewrite PromoBar with React Bootstrap + dynamic Activity fetch
dethan3 51d09ee
feat: replace promo bar with hero carousel
dethan3 f527d0e
refactor(home): address hero carousel review feedback
dethan3 e164187
recover downlevelIteration
dethan3 a5e8e6c
refactor(home): address hero carousel review feedback
dethan3 bc438a9
[optimize] simplify AI codes
TechQuery 9e3a245
Merge branch 'main' into labor-hackathon-2026
TechQuery f023eef
[optimize] update Upstream packages
TechQuery e05aaed
[fix] revert ISR to SSR for Lark API compatibility
TechQuery 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 hidden or 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,153 @@ | ||
| .promoBar { | ||
| position: sticky; | ||
| top: var(--promo-bar-offset, 4.125rem); | ||
| z-index: 1020; | ||
| margin-top: var(--promo-bar-gap, 0.625rem); | ||
| box-shadow: 0 10px 32px rgb(0 0 0 / 35%); | ||
| background: linear-gradient( | ||
| 135deg, | ||
| #0c0e2b 0%, | ||
| #1a0b4e 20%, | ||
| #312e81 40%, | ||
| #1e40af 60%, | ||
| #0891b2 80%, | ||
| #0d9488 100% | ||
| ); | ||
| } | ||
|
|
||
| .promoBarInner { | ||
| width: min(100%, 1180px); | ||
| } | ||
|
|
||
| .promoBarContent { | ||
| flex: 1 1 auto; | ||
| gap: 1.25rem; | ||
| padding: 0.75rem 0; | ||
| min-width: 0; | ||
| color: inherit; | ||
|
|
||
| &:hover, | ||
| &:focus, | ||
| &:active { | ||
| color: inherit; | ||
| text-decoration: none; | ||
|
|
||
| .promoBarAction { | ||
| box-shadow: 0 0 12px rgb(139 92 246 / 40%); | ||
| background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #22d3ee 100%); | ||
| color: #ffffff; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .promoBarText { | ||
| flex: 0 0 auto; | ||
| gap: 0.7rem; | ||
| min-width: 0; | ||
| line-height: 1.35; | ||
|
|
||
| strong { | ||
| flex: 0 0 auto; | ||
| color: #ffffff; | ||
| font-size: 1rem; | ||
| text-shadow: 0 0 8px rgb(139 92 246 / 30%); | ||
| } | ||
|
|
||
| span { | ||
| min-width: 0; | ||
| color: #a5f3fc; | ||
| font-size: 0.92rem; | ||
| } | ||
| } | ||
|
|
||
| .promoBarEventName { | ||
| flex: 0 0 auto; | ||
| background: linear-gradient(90deg, #c4b5fd, #67e8f9); | ||
| background-clip: text; | ||
| -webkit-background-clip: text; | ||
| -webkit-text-fill-color: transparent; | ||
| font-weight: 700; | ||
| font-size: 0.92rem; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .promoBarAction { | ||
| flex: 0 0 auto; | ||
| transition: all 200ms ease; | ||
| box-shadow: 0 0 10px rgb(139 92 246 / 25%); | ||
| border: 1px solid rgb(255 255 255 / 20%); | ||
| border-radius: 999px; | ||
| background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%); | ||
| padding: 0.42rem 0.85rem; | ||
| color: #ffffff; | ||
| font-weight: 700; | ||
| font-size: 0.88rem; | ||
| line-height: 1.1; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .promoBarClose { | ||
| flex: 0 0 2.5rem; | ||
| opacity: 0.6; | ||
| margin: 0 0 0 0.5rem; | ||
| width: 2.5rem; | ||
|
|
||
| &:hover, | ||
| &:focus { | ||
| opacity: 1; | ||
| } | ||
| } | ||
|
|
||
| @media (max-width: 767.98px) { | ||
| .promoBar { | ||
| top: var(--promo-bar-offset, 4.125rem); | ||
| } | ||
|
|
||
| .promoBarInner { | ||
| padding: 0 0.75rem; | ||
| } | ||
|
|
||
| .promoBarContent { | ||
| flex-wrap: nowrap; | ||
| gap: 0.55rem 0.75rem; | ||
| padding: 0.58rem 0; | ||
| } | ||
|
|
||
| .promoBarText { | ||
| flex: 1 1 auto; | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| gap: 0.15rem; | ||
|
|
||
| strong { | ||
| flex: 1 1 auto; | ||
| max-width: 100%; | ||
| overflow: hidden; | ||
| font-size: 0.9rem; | ||
| text-overflow: ellipsis; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| span { | ||
| display: -webkit-box; | ||
| overflow: hidden; | ||
| font-size: 0.82rem; | ||
| line-height: 1.25; | ||
| -webkit-box-orient: vertical; | ||
| -webkit-line-clamp: 1; | ||
| line-clamp: 1; | ||
| } | ||
| } | ||
|
|
||
| .promoBarAction { | ||
| margin-left: 0; | ||
| padding: 0.38rem 0.55rem; | ||
| font-size: 0.8rem; | ||
| } | ||
|
|
||
| .promoBarClose { | ||
| flex-basis: 2rem; | ||
| margin-left: 0.1rem; | ||
| width: 2rem; | ||
| } | ||
| } |
This file contains hidden or 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,87 @@ | ||
| import { CSSProperties, FC, useContext, useEffect, useState } from 'react'; | ||
| import { Alert, CloseButton } from 'react-bootstrap'; | ||
|
|
||
| import { normalizeText, TableCellText } from 'mobx-lark'; | ||
|
|
||
| import { Activity, ActivityModel } from '../../models/Activity'; | ||
| import { I18nContext } from '../../models/Translation'; | ||
| import styles from './PromoBar.module.less'; | ||
|
|
||
| export const PromoBar: FC = () => { | ||
| const { t } = useContext(I18nContext); | ||
| const [isVisible, setIsVisible] = useState(true); | ||
| const [barStyle, setBarStyle] = useState<CSSProperties>(); | ||
| const [activity, setActivity] = useState<Activity>(); | ||
|
|
||
| useEffect(() => { | ||
| const navbar = document.querySelector('nav'); | ||
| const syncTopBarOffset = () => { | ||
| const navbarHeight = navbar?.getBoundingClientRect().height || 56; | ||
|
|
||
| setBarStyle({ | ||
| '--promo-bar-gap': `${Math.max(navbarHeight - 56, 0)}px`, | ||
| '--promo-bar-offset': `${navbarHeight}px`, | ||
| } as CSSProperties); | ||
| }; | ||
| const observer = | ||
| typeof ResizeObserver === 'undefined' || !navbar | ||
| ? undefined | ||
| : new ResizeObserver(syncTopBarOffset); | ||
|
|
||
| syncTopBarOffset(); | ||
| if (navbar) observer?.observe(navbar); | ||
| window.addEventListener('resize', syncTopBarOffset); | ||
|
|
||
| return () => { | ||
| observer?.disconnect(); | ||
| window.removeEventListener('resize', syncTopBarOffset); | ||
| }; | ||
| }, []); | ||
|
|
||
| useEffect(() => { | ||
| (async () => { | ||
| try { | ||
| const model = new ActivityModel(); | ||
| const data = await model.getOne('Labor-AI-hackathon-2026'); | ||
| setActivity(data); | ||
| } catch (err) { | ||
| console.error('Failed to load activity:', err); | ||
| } | ||
| })(); | ||
| }, []); | ||
|
|
||
| const closeBar = () => setIsVisible(false); | ||
|
|
||
| if (!isVisible) return null; | ||
|
|
||
| return ( | ||
| <Alert | ||
| role="banner" | ||
| className={`${styles.promoBar} d-flex flex-column w-100 text-white mb-0 p-0 border-0 rounded-0`} | ||
| aria-label={t('home_hackathon_top_bar_aria_label')} | ||
| style={barStyle} | ||
| > | ||
| <div className={`${styles.promoBarInner} d-flex align-items-center mx-auto px-3`}> | ||
| <Alert.Link | ||
| className={`${styles.promoBarContent} d-flex justify-content-center align-items-center text-decoration-none`} | ||
| href={activity ? ActivityModel.getLink(activity) : '/hackathon/Labor-AI-hackathon-2026'} | ||
| > | ||
| <span className={`${styles.promoBarText} d-flex align-items-baseline`}> | ||
| <strong>{t('home_hackathon_top_bar_title')}</strong> | ||
| <span>{t('home_hackathon_top_bar_description')}</span> | ||
| </span> | ||
| <span className={styles.promoBarEventName}> | ||
| {activity ? normalizeText(activity.name as TableCellText) : 'Labor AI Hackathon 2026'} | ||
| </span> | ||
| <span className={styles.promoBarAction}>{t('home_hackathon_top_bar_action')}</span> | ||
| </Alert.Link> | ||
| <CloseButton | ||
| className={`${styles.promoBarClose} p-0 rounded`} | ||
| variant="white" | ||
| aria-label={t('home_hackathon_top_bar_close')} | ||
| onClick={closeBar} | ||
| /> | ||
| </div> | ||
| </Alert> | ||
| ); | ||
| }; | ||
This file contains hidden or 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
|
dethan3 marked this conversation as resolved.
|
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.