Skip to content

Commit

Permalink
fix btnType error
Browse files Browse the repository at this point in the history
  • Loading branch information
drl990114 committed Apr 16, 2024
1 parent dcd5267 commit 2773ffd
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zens",
"version": "0.0.12",
"version": "0.0.14",
"description": "MarkFlowy's ui component library.",
"keywords": [],
"homepage": "https://github.com/drl990114/zens#readme",
Expand Down
9 changes: 9 additions & 0 deletions src/Button/demo/btnType.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Button, Space } from 'zens';

export default () => {

return <Space>
<Button>default</Button>
<Button btnType='primary' >primary</Button>
</Space>
}
4 changes: 4 additions & 0 deletions src/Button/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ group:
### 基本用法

<code src="./demo/basic.tsx"></code>

### 按钮类型

<code src="./demo/btnType.tsx"></code>
4 changes: 3 additions & 1 deletion src/Button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const Button: IStyledComponent<'web', ButtonProps> = styled(AkButton).attrs<Butt
(props) => ({
...props,
}),
)`
).withConfig({
shouldForwardProp: (propName: string) => propName !== 'btnType' && propName !== 'size',
})`
display: flex;
user-select: none;
align-items: center;
Expand Down
4 changes: 2 additions & 2 deletions src/Theme/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export const ThemeProvider: React.FC<Props> = ({ theme, children }: Props) => {
function shouldForwardProp(propName: string, target: any) {
if (typeof target === 'string') {
// For HTML elements, forward the prop if it is a valid HTML attribute
return isPropValid(propName);
return isPropValid(propName)
}
// For other elements, forward all props
return true;
return true
}
2 changes: 1 addition & 1 deletion src/Theme/dark.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const styledDarkTheme = {
primaryFontColor: '#c8d1d9',
labelFontColor: 'rgba(255, 255, 255, 0.5)',
accentColor: '#1c78aa',
accentColor: '#016ab3',
borderColor: '#363b41',
bgColor: '#05010d',
hoverColor: '#1f2225',
Expand Down
2 changes: 1 addition & 1 deletion src/Theme/light.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const styledLightTheme = {
primaryFontColor: '#000000',
labelFontColor: '#9ca3af',
accentColor: '#0369a1',
accentColor: '#007acc',
borderColor: '#d7d7dc',
bgColor: '#fdfdfd',
hoverColor: '#d7d7dc',
Expand Down

0 comments on commit 2773ffd

Please sign in to comment.