| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | import type {ReactNode} from 'react'; |
| 9 | |
| 10 | import * as stylex from '@stylexjs/stylex'; |
| 11 | import {colors, font} from './theme/tokens.stylex'; |
| 12 | |
| 13 | const styles = stylex.create({ |
| 14 | linkButton: { |
| 15 | fontSize: font.normal, |
| 16 | textDecoration: 'underline', |
| 17 | border: 'none', |
| 18 | background: 'none', |
| 19 | margin: 0, |
| 20 | padding: 0, |
| 21 | color: colors.fg, |
| 22 | cursor: 'pointer', |
| 23 | ':hover': { |
| 24 | color: colors.brightFg, |
| 25 | }, |
| 26 | }, |
| 27 | }); |
| 28 | |
| 29 | export function LinkButton({ |
| 30 | children, |
| 31 | onClick, |
| 32 | style, |
| 33 | }: { |
| 34 | children: ReactNode; |
| 35 | onClick: () => unknown; |
| 36 | style?: stylex.StyleXStyles; |
| 37 | }) { |
| 38 | return ( |
| 39 | <button {...stylex.props(styles.linkButton, style)} onClick={onClick}> |
| 40 | {children} |
| 41 | </button> |
| 42 | ); |
| 43 | } |
| 44 | |