mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-15 16:56:56 +08:00
refactor: extract repeated star formatting logic
- Extract formattedStars calculation to avoid duplication - Keep tabular-nums span for consistent number width during animation - Address code review feedback from @xqliu 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
@@ -22,6 +22,9 @@ export default function HeroSection({ language }: HeroSectionProps) {
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 格式化 stars 显示
|
||||||
|
const formattedStars = (animatedStars / 1000).toFixed(1)
|
||||||
|
|
||||||
const fadeInUp = {
|
const fadeInUp = {
|
||||||
initial: { opacity: 0, y: 60 },
|
initial: { opacity: 0, y: 60 },
|
||||||
animate: { opacity: 1, y: 0 },
|
animate: { opacity: 1, y: 0 },
|
||||||
@@ -48,12 +51,12 @@ export default function HeroSection({ language }: HeroSectionProps) {
|
|||||||
) : language === 'zh' ? (
|
) : language === 'zh' ? (
|
||||||
<>
|
<>
|
||||||
{daysOld} 天内{' '}
|
{daysOld} 天内{' '}
|
||||||
<span className='inline-block tabular-nums'>{(animatedStars / 1000).toFixed(1)}</span>
|
<span className='inline-block tabular-nums'>{formattedStars}</span>
|
||||||
K+ GitHub Stars
|
K+ GitHub Stars
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<span className='inline-block tabular-nums'>{(animatedStars / 1000).toFixed(1)}</span>
|
<span className='inline-block tabular-nums'>{formattedStars}</span>
|
||||||
K+ GitHub Stars in {daysOld} days
|
K+ GitHub Stars in {daysOld} days
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user