web3ui / web3uikit

Lightweight reusable Web3 UI components for dapps.
https://web3uikit.com
MIT License
1.72k stars 269 forks source link

React18 refactor Badge #358

Closed BillyG83 closed 2 years ago

BillyG83 commented 2 years ago

Test like this

import {
    render,
    screen,
    fireEvent,
    act,
    waitFor,
} from '@testing-library/react';

const copyIconTestId = 'this-component';

test('Should render the component', () => {
    render(<ThisComponent />);
    const element = screen.getByTestId(copyIconTestId);
    expect(element).not.toBeNull();

    // Verify that the `icon copy` is visible
    expect(element.textContent).toBe(`${iconTypes.copy} icon`);
});

Scope CSS like this

this is bad, intellisense is going crazy

export const ButtonStyled = styled.button`
   // CSS stuff here
`;

this is better

const ButtonStyled = styled.button`
   // CSS stuff here
`;

export default {
  ButtonStyled,
}

then import like this

import styles from './ThisComponent.styles';

const { ButtonStyled, } = styles;

need help?

check this PR i already did this for Accordion =] https://github.com/web3ui/web3uikit/pull/356

AbhinavMV commented 2 years ago

I am working on this