Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add drawer component #64

Merged
merged 44 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f6f4ba4
feat: add message component.
Jun 11, 2020
dd36596
fix: fix message ui
Jun 11, 2020
784b676
fix: fix ui
Jun 12, 2020
bf46804
fix: change animate
Jun 12, 2020
8080cc1
fix: fix toast ui and add Toast.info function.
Jun 15, 2020
c99f0f9
Adding test: add toast tests.
Jun 15, 2020
ea1654b
feat: merge master
Jun 15, 2020
ef52fd8
docs: change demo text
Jun 15, 2020
7e1bd2c
Delete Playground.jsx
1eeing Jun 15, 2020
9244713
Update index.zh-CN.md
1eeing Jun 15, 2020
7661c91
Update index.zh-CN.md
1eeing Jun 15, 2020
6d933ef
Merge remote-tracking branch 'upstream/master'
Jul 28, 2020
037c76f
Merge remote-tracking branch 'upstream/master'
Aug 3, 2020
1e89947
Update
Aug 4, 2020
fc4ede1
Merge remote-tracking branch 'upstream/master'
Aug 4, 2020
7ce35be
feat: add Input component and replace Icon which in Toast component
Aug 5, 2020
dcaae99
fix: fix Icon in Toast
Aug 5, 2020
35b5de2
fix: replace icon
Aug 5, 2020
683b5fd
fix: fix icon in Toast
Aug 5, 2020
6e381f0
Merge remote-tracking branch 'upstream/master'
Aug 5, 2020
cbf3486
Fix lint
Aug 5, 2020
260ac2c
Fix cli and remove unused package.
Aug 5, 2020
1abfbc2
Delete
Aug 5, 2020
1c8d869
reset
Aug 5, 2020
f42b41f
some change.
Aug 6, 2020
130dee8
Update
Aug 10, 2020
c42f1fd
Add Drawer component
Aug 10, 2020
5418f5a
Merge remote-tracking branch 'upstream/master' into feature-drawer
Aug 10, 2020
1450964
Fix: lint fix
Aug 10, 2020
b456f32
Fix: fix icons' name.
Aug 10, 2020
ea2395e
Merge branch 'originMaster'
Aug 11, 2020
403cdf9
Merge branch 'master' into feature-drawer
Aug 11, 2020
04289d2
fix: some input fix.
Aug 11, 2020
445c222
Merge branch 'originMaster'
Aug 11, 2020
b58c219
Merge branch 'master' into feature-drawer
Aug 11, 2020
3342b59
fix: add eslint optional chain
Aug 11, 2020
74b5585
Fix comment
Aug 12, 2020
da73fb1
Merge branch 'originMaster' into feature-drawer
Aug 12, 2020
4fc4457
Add drawer
Aug 12, 2020
77ca365
Merge branch 'originMaster' into feature-drawer
Aug 12, 2020
bc53d7e
Delete
Aug 12, 2020
58ff83a
Merge branch 'feature-drawer' of github.com:1eeing/gio-design into fe…
Aug 12, 2020
a53df66
fix: fix drawer demo ui
Aug 12, 2020
c21153f
Merge branch 'master' into feature-drawer
jack0pan Aug 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,7 @@ module.exports = {

// 关闭 禁止 this 关键字在类或类对象之外出现
'@typescript-eslint/no-invalid-this': OFF,

'@typescript-eslint/prefer-optional-chain': OFF,
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"build:icons": "yarn workspace @gio-design/icons build",
"build:components": "yarn workspace @gio-design/components build",
"build:icon-generator": "yarn workspace @gio-design/react-svg-icon-generator build",
"g:icons": "yarn workspace @gio-design/icons generate",
"publish": "npx lerna publish",
"lint": "yarn lint:components",
"lint:components": "eslint packages/components/src --ext .js,.jsx,.ts,.tsx",
Expand Down
1 change: 1 addition & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"pinyin-match": "^1.0.8",
"rc-animate": "^3.1.0",
"rc-checkbox": "^2.2.0",
"rc-drawer": "^4.1.0",
"rc-notification": "^3.3.1",
"rc-tabs": "^11.5.2",
"rc-tooltip": "^4.2.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactNode, useState } from 'react';
import classnames from 'classnames';

import { CheckCircleFilled, Warning, InformationFilled, CloseCircleFilled, Close } from '@gio-design/icons';
import { CheckCircleFilled, WarningFilled, InformationFilled, CloseCircleFilled, Close } from '@gio-design/icons';

interface AlertProps {
afterClose?: any;
Expand All @@ -27,7 +27,7 @@ const Alert: React.FC<AlertProps> = (props) => {
case 'success':
return <CheckCircleFilled />;
case 'warning':
return <Warning />;
return <WarningFilled />;
case 'error':
return <CloseCircleFilled />;
default:
Expand Down
79 changes: 79 additions & 0 deletions packages/components/src/components/config-provider/context.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import * as React from 'react';
import { SizeType } from './SizeContext';

export interface CSPConfig {
nonce?: string;
}

export interface ConfigConsumerProps {
getTargetContainer?: () => HTMLElement;
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
rootPrefixCls?: string;
getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
csp?: CSPConfig;
autoInsertSpaceInButton?: boolean;
input?: {
autoComplete?: string;
};
pageHeader?: {
ghost: boolean;
};
direction?: 'ltr' | 'rtl';
space?: {
size?: SizeType | number;
};
virtual?: boolean;
dropdownMatchSelectWidth?: boolean;
}

export const ConfigContext = React.createContext<ConfigConsumerProps>({
zzt1224 marked this conversation as resolved.
Show resolved Hide resolved
// We provide a default function for Context without provider
getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => {
if (customizePrefixCls) return customizePrefixCls;

return suffixCls ? `gio-${suffixCls}` : 'gio';
},
});

export const ConfigConsumer = ConfigContext.Consumer;

// =========================== withConfigConsumer ===========================
// We need define many types here. So let's put in the block region
type IReactComponent<P = any> = React.FC<P> | React.ComponentClass<P> | React.ClassicComponentClass<P>;

interface BasicExportProps {
prefixCls?: string;
}

interface ConsumerConfig {
prefixCls: string;
}

interface ConstructorProps {
displayName?: string;
}
export function withConfigConsumer<ExportProps extends BasicExportProps>(config: ConsumerConfig) {
return function withConfigConsumerFunc<ComponentDef>(
Component: IReactComponent
): React.FC<ExportProps> & ComponentDef {
// Wrap with ConfigConsumer. Since we need compatible with react 15, be care when using ref methods
const SFC = ((props: ExportProps) => (
<ConfigConsumer>
{(configProps: ConfigConsumerProps) => {
const { prefixCls: basicPrefixCls } = config;
const { getPrefixCls } = configProps;
const { prefixCls: customizePrefixCls } = props;
const prefixCls = getPrefixCls(basicPrefixCls, customizePrefixCls);
return <Component {...configProps} {...props} prefixCls={prefixCls} />;
}}
</ConfigConsumer>
)) as React.FC<ExportProps> & ComponentDef;

const cons: ConstructorProps = Component.constructor as ConstructorProps;
const name = (cons && cons.displayName) || Component.name || 'Component';

SFC.displayName = `withConfigConsumer(${name})`;

return SFC;
};
}
Loading