Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow custom className
Browse files Browse the repository at this point in the history
Niznikr committed Dec 13, 2023
1 parent d6f58e8 commit beb2bd1
Showing 5 changed files with 22 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -106,7 +106,8 @@ module.exports = {
},
overrides: [
{
files: ['**/__tests__/**/*.spec.[jt]s?(x)'],
files: ['**/__tests__/**/*.spec.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
excludedFiles: 'playwright/*',
extends: ['plugin:testing-library/react'],
},
{
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": true
"source.fixAll.stylelint": "explicit"
},
"eslint.workingDirectories": ["./", "./apps/remix"]
}
3 changes: 2 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -33,7 +33,8 @@
},
"dependencies": {
"@launchpad-ui/tokens": "workspace:~",
"react-aria-components": "1.0.0-rc.0"
"react-aria-components": "1.0.0-rc.0",
"clsx": "2.0.0"
},
"peerDependencies": {
"@stylexjs/stylex": "0.3.0",
11 changes: 9 additions & 2 deletions packages/components/src/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import type { StyleXStyles } from '@stylexjs/stylex';
import type { ProgressBarProps as AriaProgressBarProps } from 'react-aria-components';

import * as stylex from '@stylexjs/stylex';
import { clsx } from 'clsx';
import { ProgressBar as AriaProgressBar } from 'react-aria-components';

import { tokens } from './tokens.stylex';
@@ -44,14 +45,20 @@ interface ProgressBarProps extends Omit<AriaProgressBarProps, 'style'> {
size?: 'small' | 'medium' | 'large';
}

const ProgressBar = ({ style, size = 'small', ...props }: ProgressBarProps) => {
const ProgressBar = ({ style, size = 'small', className, ...props }: ProgressBarProps) => {
const center = 16;
const strokeWidth = 4;
const r = 16 - strokeWidth;
const c = 2 * r * Math.PI;

const stylexProps = stylex.props(styles.base, styles[size], style);

return (
<AriaProgressBar {...props} {...stylex.props(styles.base, styles[size], style)}>
<AriaProgressBar
{...props}
className={clsx(stylexProps.className, className)}
style={stylexProps.style}
>
{({ percentage }) => (
<svg
width={64}
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit beb2bd1

Please sign in to comment.