addons/components/LinkButton.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import type {ReactNode} from 'react';
b69ab319
b69ab3110import * as stylex from '@stylexjs/stylex';
b69ab3111import {colors, font} from './theme/tokens.stylex';
b69ab3112
b69ab3113const styles = stylex.create({
b69ab3114 linkButton: {
b69ab3115 fontSize: font.normal,
b69ab3116 textDecoration: 'underline',
b69ab3117 border: 'none',
b69ab3118 background: 'none',
b69ab3119 margin: 0,
b69ab3120 padding: 0,
b69ab3121 color: colors.fg,
b69ab3122 cursor: 'pointer',
b69ab3123 ':hover': {
b69ab3124 color: colors.brightFg,
b69ab3125 },
b69ab3126 },
b69ab3127});
b69ab3128
b69ab3129export function LinkButton({
b69ab3130 children,
b69ab3131 onClick,
b69ab3132 style,
b69ab3133}: {
b69ab3134 children: ReactNode;
b69ab3135 onClick: () => unknown;
b69ab3136 style?: stylex.StyleXStyles;
b69ab3137}) {
b69ab3138 return (
b69ab3139 <button {...stylex.props(styles.linkButton, style)} onClick={onClick}>
b69ab3140 {children}
b69ab3141 </button>
b69ab3142 );
b69ab3143}