1.2404.1 • Published 21 days ago

@talxis/react-components v1.2404.1

Weekly downloads
-
License
MIT
Repository
-
Last release
21 days ago

Building the components locally

  1. Run npm install inside the root directory.
  2. Run npm run sandbox. This will run the sandbox environment located in src/sandbox, where you can import and test all of the components (the source code for all components is located in src/components).
  3. Optionally, you can run npm run documentation to view the current documentation for existing components and use it for testing purposes.

Testing the components locally in Portal

  1. Run npm i yalc -g (only needed once)
  2. Navigate to the shared components root directory.
  3. Run npm run build.
  4. Run yalc publish.
  5. Go to the Portal.Web.Frontend directory and run yalc add @talxis/react-components. This will replace the NPM package in package.json with the locally built version.
  6. Run the Portal.

If you want to see the latest changes applied, repeat steps 2 and 3 and run yalc update in the Portal.Web.Frontend directory. Don't forget to revert the package.json file to the original version before pushing any changes to the Portal repo!

Publishing changes to NPM

The package gets published to the NPM repository automatically when your branch gets merged to master.

Developing new component

Every newly created component should respect the Fluent UI design pattern. However, not all Fluent UI components are unified in their looks and functionality (for example error messages). To overcome this, we have created a separate interface for each core component functionality. Each interface has a guideline on how it's look and functionality should be implemented. Please familiarize yourself with the guidelines (also look at existing components that implement them) and follow them.

Guidelines

There are few guidelines that need to be followed when developing new components:

Code Structure

  1. All the code for the newly developed component has to be located in the src/components/component_name folder.
  2. The component_name folder should contain the following files: index.tsx, styles.ts (optional). The index.tsx file should contain the component's code. The styles.ts file should contain component's styling using the mergeStyles library. This is currently the only supported styling approach for scoping reasons.
  3. While writing the styles, keep in mind that all classes should be prefixed with the component's name eg .TALXIS__textfield. Any other classes within the component should follow the same prefix, eg .TALXIS__textfield__button. As for naming conventions, we are using the BEM Naming System.

Visuals and functionality

A newly developed component should, apart from the new features specific to itself also include basic features and looks that are already implemented in the existing components. For example, while developing a component that has some input as it's base, the component should also have a borderless and read only variant (and also few other functionalities). To make the implementation easier, each component can decide which features it wants to include by implementing corresponding interfaces. Currently, we support these interfaces: 1. IDisabled - for components that can be disabled, meaning that they can't be interacted with.

  1. IBorderless - for components that have a borderless variant. The borderless mode has to support the slide in animation on hover while also allowing it to be disabled by the disableHoverAnimation prop. The border should also be using a fade in animation. The borderless mode should not get applied when the component is in disabled state.

  2. IReadOnly - for components that have a read only variant. The read only mode should disable any attempts to change the component's value, but any action buttons present (apart for buttons that change the component's value) should be enabled.

  3. IPrefix - for components, that can have an N number of action buttons before component's main content. These buttons should be active by default in read only mode and disabled while the component is in disabled state. Please refer to the TextField component for guidance on how to implement this interface.

  4. ISuffix - for components, that can have an N number of action buttons after component's main content. These buttons should be active by default in read only mode and disabled while the component is in disabled state Please refer to the TextField component for guidance on how to implement this interface.

  5. ICopyButton - for components that have a copy button. The copy button should be active by default in read only mode and disabled while the component is in disabled state. Also, the copy button should only be visible when the component's value is not empty (eg, if there is something to copy). If used along with the ISuffix interface, the copy button should be a part of the suffix items.

  6. IDeleteButton - for components that have a delete button. The delete button should not be visible when the component's value is empty (eg, if there is nothing to delete) or the component is in the read only mode. The button should also appear disabled while the component is in disabled state. If used along with the ISuffix interface, the delete button should be a part of the suffix items. It should also be the last item. Remember that all buttons (this includes IPrefix, ISuffix, ICopyButton and IDeleteButton) should have a fade in animation if the showOnlyOnHover prop is set to true!

  7. IErrorMessage - for components that can show an error message. You can you the predefined <ErrorMessage> component to make this implementation easier. The component should also have a red border around it if possible (even in disabled state).

Since we often have to create customer specific CSS, we should always mention the component's state in the root CSS class in situations where it makes sense. For example, we might encounter a situation where we want to change the border color of a component when it's disabled. In this case, we should generate the following CSS class: .TALXIS__textfield--disabled when the component is disabled and so on. Please refer to existing components to see the class generation logic for different states.

NOTE: You can also refer the state within the data-attribute of the root element, eg. data-disabled={true}.

Of course, not every component has to implement all of the interfaces. That's why It's ideal to consult the component's functionality with other guys (Zdenek Srejber, Tomas Prokop, Jan Hajek, Dominik Brych) in the team to see which functionalitites are needed and which ones are not.

Documentation

Every new developed component has to have a documentation page. The documentation page should describe the component's functionality and how to use it. The documentation is handled by a framework called Storybook. While creating a documentation for your component, you should refer to their documentation as well as to our documentation for existing components.

Notes

Full docs can be found here. If you encounter any problems or bugs in the existing components, please refer to Dominik Brych.

1.2404.1

21 days ago

1.2401.2

3 months ago

1.2401.1

4 months ago

1.2312.1

5 months ago

1.2311.1

5 months ago

1.2308.1

9 months ago

1.2308.2

9 months ago

1.2308.3

9 months ago

1.2309.1

8 months ago

1.2306.1

11 months ago

1.2303.1

1 year ago

1.2303.2

1 year ago

1.2305.1

12 months ago

1.2303.3

1 year ago

1.2305.2

12 months ago

1.2303.4

1 year ago

1.2305.3

12 months ago

1.2303.5

1 year ago

1.2303.6

1 year ago

1.2302.1

1 year ago

1.2302.2

1 year ago

1.2302.3

1 year ago

1.2302.4

1 year ago

1.2302.5

1 year ago

1.2301.3

1 year ago

1.2212.1

1 year ago

1.2212.2

1 year ago

1.2301.1

1 year ago

1.2301.2

1 year ago

1.2210.7

2 years ago

1.2210.6

2 years ago

1.2210.3

2 years ago

1.2211.1

1 year ago

1.2210.2

2 years ago

1.2210.5

2 years ago

1.2210.4

2 years ago

1.2206.9

2 years ago

1.2206.7

2 years ago

1.2206.8

2 years ago

1.2206.5

2 years ago

1.2207.5

2 years ago

1.2206.6

2 years ago

1.2208.1

2 years ago

1.2207.2

2 years ago

1.2206.3

2 years ago

1.2207.3

2 years ago

1.2206.4

2 years ago

1.2207.1

2 years ago

1.2206.1

2 years ago

1.2206.2

2 years ago

1.2205.1

2 years ago

1.2204.3

2 years ago

1.2204.4

2 years ago

1.2204.1

2 years ago

1.2204.2

2 years ago

1.2202.33

2 years ago

1.2202.32

2 years ago

1.2202.31

2 years ago

1.2202.30

2 years ago

1.2202.29

2 years ago

1.2202.28

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago