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