Files
jinhojang6 37f744cc0b fix(lambda-prize): show three distinct featured prizes linking to GitHub
The featured prizes all duplicated LP-0017. Replace with the three real
prizes and deep-link each card to its prize spec on GitHub.

- Prizes: LP-0017 (Whistleblower, Medium, $400), LP-0008 (Autonomous AI
  Module, Large, $1,200), LP-0016 (Anonymous Forum, Large, $1,200); copy
  matched to logos.co/lambda-prize
- Each card "Learn More" now links to
  github.com/logos-co/lambda-prize/blob/master/prizes/<id>.md (new tab)
- Button wrapper: external http(s) hrefs render a native target=_blank anchor
  instead of next-intl Link (which would locale-prefix and break the URL)
2026-06-03 02:04:36 +09:00

37 lines
1.4 KiB
TypeScript

/**
* App-level Button wrapper that pre-binds next-intl's `Link` to the `@acid-info/logos-ui`
* Button primitive. Use this in apps/web wherever an internal route is linked
* so locale-aware navigation is preserved.
*/
import { Button as UIButton, type ButtonProps } from '@acid-info/logos-ui'
import { Link } from '@/i18n/navigation'
export { ButtonArrowIcon } from '@acid-info/logos-ui'
export type { ButtonProps, ButtonVariant } from '@acid-info/logos-ui'
export function Button(props: ButtonProps) {
if ('href' in props && props.href !== undefined) {
// External URLs render a native <a> that opens in a new tab — routing them
// through next-intl's Link would prepend the active locale and break the
// link.
if (/^https?:\/\//.test(props.href)) {
return (
<UIButton
linkAs={'a' as const}
target="_blank"
rel="noopener noreferrer"
{...props}
/>
)
}
// Same-page hash anchors (e.g. "#map") render a native <a>; everything else
// gets next-intl's locale-aware Link. Routing a hash through Link makes the
// App Router re-append it on repeat navigations, producing "#map#map" — a
// native anchor just sets location.hash and never doubles it.
const linkAs = props.href.startsWith('#') ? ('a' as const) : Link
return <UIButton linkAs={linkAs} {...props} />
}
return <UIButton {...props} />
}