@fewbox/den-web 0.2.0-preview.30 → 0.2.0-preview.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,54 +19,32 @@ $body-color: #e1e1e1;
19
19
 
20
20
  ## 3. Use
21
21
  ```tsx
22
- import { Den } from '@fewbox/den-web'; // @fewbox/den-app
23
- <Den.Components.VLabel frontColor={Den.Components.ColorType.Primary} caption='Hello, FewBox!' />
22
+ import { VLabel, ColorType } from '@fewbox/den-web'; // @fewbox/den-app
23
+
24
+ <VLabel frontColor={ColorType.Primary} caption='Hello, FewBox!' />
24
25
  ```
25
26
 
26
27
  ## 4. Custom Component
27
28
  ```tsx
28
- // Class Component
29
-
30
- import { Den } from '@fewbox/den-web'; // @fewbox/den-app
31
- import './index.scss';
32
-
33
- export interface IClassComponentProps extends Den.Interface.IBaseProps {
34
- message: string;
35
- }
36
-
37
- export interface IClassComponentStates extends Den.Interface.IBaseStates {
38
- }
39
-
40
- export default class ClassComponent extends Den.Components.BaseComponent<IClassComponentProps, IClassComponentStates> {
41
- render(): React.ReactNode {
42
- return <Den.Components.VBoundary {...this.props} className={this.getClassName('class-component')} style={this.getStyle()}>
43
- <Den.Components.VLabel caption={this.props.message} />
44
- </Den.Components.VBoundary>;
45
- }
46
- }
47
- // Function Component
48
-
49
- import { Den } from '@fewbox/den-web'; // @fewbox/den-app
29
+ import React from 'react';
30
+ import { Base, VBoundary, VLabel } from '@fewbox/den-web'; // @fewbox/den-app
31
+ import type { IBaseProps } from '@fewbox/den-web';
50
32
  import './index.scss';
51
33
 
52
- export interface IFunctionComponentProps extends Den.Interface.IBaseProps {
53
- isSelected: boolean;
54
- }
55
-
56
- export interface IFunctionComponentStates extends Den.Interface.IBaseStates {
34
+ export interface IFunctionComponentProps extends IBaseProps {
57
35
  isSelected: boolean;
58
36
  }
59
37
 
60
38
  const FunctionComponent = (props: IFunctionComponentProps) => {
61
- const { ...rest } = props;
62
- const _base = Den.Components.Base(rest);
63
- const [state, setState] = React.useState<IFunctionComponentStates>({ isSelected: props.isSelected });
39
+ const { isSelected, ...rest } = props;
40
+ const _base = Base(rest);
41
+ const [selected, setSelected] = React.useState(isSelected);
64
42
  return (
65
- <div className={_base.getClassName(`function-component${state.isSelected ? ' selected' : ''}`)} style={_base.getStyle()} {..._base.getHtmlProps()}>
43
+ <div className={_base.getClassName(`function-component${selected ? ' selected' : ''}`)} style={_base.getStyle()} {..._base.getProps('div').html}>
66
44
  Click Me
67
45
  </div>
68
46
  );
69
47
  }
70
48
 
71
49
  export default FunctionComponent;
72
- ```
50
+ ```