10.6.1 • Published 12 days ago

devs-react-component-library v10.6.1

Weekly downloads
-
License
ISC
Repository
-
Last release
12 days ago

React Developers components

Components

  1. Box
  2. Fonts
  3. Accordion
  4. button
  5. Dropdown
  6. Input
  7. Image
  8. Table

ThemeTypes

const theme: ThemeTypes = {
	palette: {
		Blue: {
			dark: {
				5: '#F2F6FA'
			},
		},
	};
	shadows,
	typography,
	zIndex,
	shape,
	fontSizes,
};

1. Flex, Grid, Container

Box

PropsValuesDefault
justifyContentstringcenter
alignItems"flex-start" , "flex-end" , "center" , "baseline" , "stretch"center
alignContent"flex-start" , "flex-end" , "center" , "space-between" , "space-around" , "stretch"null
widthstring eg: 20px100%
heightstring eg: 20px100%
textAlign"left" , "right" , "center" , "justify" , "inherit"center
wrap(fle-wrap)"nowrap" , "wrap" , "wrap-reverse"wrap
direction(flex-direction)row, row-reverse, column, column-reverserow
marginstring. Eg: 20px0
pad(padding)string0
bgColor(background-color)string from themetransparent

Usage

const { Flex } = Components(theme)

const App = () => (
	<Flex
		justifyContent="center"
		bgColor='Blue.dark.5'
		// ...other propps if needed
	>
		This is a div
	</Flex>
)

Grid

PropsValuesDefault
columns(grid-template-columns)string1fr
rows(gird-template-rows)stringauto
gap(grid-gap)string10px
justifyContentstringcenter
alignItems"flex-start" , "flex-end" , "center" , "baseline" , "stretch"center
width100%

Usage

import { Components, ThemeTypes } from "devs-react-component-library"

const theme: ThemeTypes = {
	// palette: 
	// shadows,
	// typography,
	// zIndex,
	// shape,
	// fontSizes,
};
const { Grid } = Components(theme)

const App = () => (
	<Grid
		row="1fr 1fr"
		// ...other propps if needed
	>
		This is a div
	</Grid>
)

   

Container

PropsValuesDefault
widthstring eg: 20px100%
heightstring eg: 20px100%
textAlign"left" , "right" , "center" , "justify" , "inherit"center
marginstring. Eg: 20px0
pad(padding)string0
bgColor(background-color)string from themetransparent

Usage

import { Components, ThemeTypes } from "devs-react-component-library"

const theme: ThemeTypes = {
	palette: {
		read:   '#F2F6FA' 
	};
	// shadows,
	// typography,
	// zIndex,
	// shape,
	// fontSizes,
};
const { Grid } = Components(theme)


const App = () => (
	<Container
		width="50px"
		bgColor='read'
		// ...other propps if needed
	>
		This is a div
	</Container>
)

2. Fonts

This applies to all fonts

UAGES

    const theme: ThemeTypes = {
       const palette = {
			white,
			common: {
				white,
				transparent,
			},
			Black: {
				default: "#062A54",
				80: "#0B2F59",
			},
		
		}
       // shadows,
       typography: {
			fontFamily: {
				quicksand: "Quicksand-regular, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif",
				quicksandLight: "Quicksand-light, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif",
			},
			fontWeight: {
				300: 300,
				400: 400,
				500: 500,
				600: 600,
				700: 700,
				normal: "normal",
			},
			lineHeight: {
				96: "96px",
				69: "69px",
			},
		}
       // zIndex,
       // shape,
       fontSizes: {
			40: "40px",  
			46: "46px",  
			64: "64px",  
		}
   };
 	export const { Span} = Components(theme);


<Span 
	fontFamily='quicksand' 
	weight="700" 
	ineHeight="69" 
	size="64" 
	colour={"Black.default"} 
	center
>
	Hello Wolrd
</Span>

Extend any font (typescript)

export const { Span, FontTypes} = Components(theme);

export const SeeAllSpan =  styled(Span)<FontTypes>`
	cursor: pointer;
`;

3. Accordion

PropsValuesDefault
gapstring5px
accordionsarray of objectnone
visiblenumbernone
setVisibleReact.Dispatch<React.SetStateAction<number>>none

USAGE

export const { Accordion} = Components(theme);


const [ visible, setVisible] = useState(-1);

const accordions = [
	{
		head: "Lorem ipsum dolo",
		details: "Lorem ips id."
	},
	{
		head: "Lorem ipsum dolor sit amet, consectetur adipisc",
		details: "Lorem ipsum dolor sit "
	},
];

<Accordion
	gap='20px'
	accordions={accordions.map((accordion, key) =>  (
		{
			head: <div>Head</div>,
			details: <div>Body of the accordion</div>,
			key
		}
	))}
	visible={visible} 
	setVisible={setVisible}
/>

4. Button

PropsValuesDefaultRequired
sizestring from themenonetre
nonActiveColorstring from themenonetrue
activeColorstring from themenonetrue
nonActiveBgColorstring from themenonetrue
nonActiveBorderColorstring from themenonetrue
activeBgColorstring from themenonetrue
activeBorderColorstring from themenonetrue
textstring from themenonetrue
borderRadiusstring from themenonetrue
padstring from themenonetrue
isLoadingbooleannonefalse
disabledbooleannonefalse
onClickfunctionnonefalse
export const { Button} = Components(theme);

<Button
	size='14'//from theme
	nonActiveColor="Black.20"//from theme
	activeColor="Black.default"//from theme
	nonActiveBgColor={"common.transparent"}//from theme
	nonActiveBorderColor={"Black.5"}//from theme
	activeBgColor="common.transparent"//from theme
	activeBorderColor="common.transparent"//from theme
	text="Don't show again"
	borderRadius="8"//from theme
	pad={"padding.0"}//from theme
	isLoading={false}
	onClick={() => []}
	disabled={false}
/>

5. Dropdown

PropsValuesDefaultRequired
weightstring from themenonetrue
directionend or startnonetrue
colourstring from themenonetrue
dropColorstring from theme from themenonetrue
dropHovColorstring from theme from themenonetrue
hovBgColorstring from themenonetrue
searchFieldbooleanfalsefalse
clearSelectedbooleanfalsefalse
placeholderstringfalsefalse
handleSelectfunctionnonetrue
initialstringundefinedfalse
searchFieldbooleantruefalse
type"showmore" or undefinedfalsefalse
dataarray of objectnonetrue

USAGE

DropdownType for
    data: {
       returnedValue: any;
       displayedValue: any;
       dropdownValue: any
   }[];
   handleSelect: (returnedValue: any, selectedvalue: any, dropdownValue: any) => void;

export const { Dropdown} = Components(theme);

<Dropdown
	weight="300"
	direction="end"
	colour="Black.default"
	dropColor="Black.80"
	dropHovColor="Black.default"
	hovBgColor="Black.20"
	searchField={false}
	handleSelect={(selected) => console.log(selected)}
	data={[
		{
			dropdownValue: "All",
			displayedValue: "All",
			returnedValue: "All"
		},
		{
			dropdownValue:  "Best",
			displayedValue:  "Best",
			returnedValue: "Best",
		},
	]}
/>

6. Input

PropsValuesDefaultRequired
handleChangefunctionnonetrue
namestringnonetrue
valuestring or numbernonetrue
disabledbooleanfalsefalse
iconAfterInputElementnonefalse
iconBeforeInputElementnonefalse
handleOnFocusfunctionnonefalse
handleOnBlurfunctionnonefalse
handleOnEmptyInputValuefunctionnonefalse
placeholderstringnonefalse
bgColstring from themetransparentfalse
borderRadiusstring from themetransparentfalse
export const { Input} = Components(theme);


<Input 
	name={name}
	type={type} 
	value={value}
	onChange={(e) =>{
		setChecked(e.target.value);
		handleOnChange &&  handleOnChange(e.target.value);
	}}
/>

7. Image

PropsValuesDefaultRequired
srcstringnonetrue
altstring""false
heightstring100%false
widthstring100%false
loadingbooleanfalsefalse
errorbooleanfalsefalse
radiusstring0false
loaderElementnonefalse
fallBackImagestringnonefalse
object'fill' od 'contain' od 'cover' od "none" od "scale-down"coverfalse

USAGE

export const { Input} = Components(theme);
<Image
	loader={<div>Loading ...</div>}
	width={"48px"}
	height={"48px"}
	src={state?.profile?.basic?.studentProfileImage?.imageUrl}
/>

8. Table

PropsValuesDefaultRequired
headColorstring from themenonetrue
headBgColorstring from themenonetrue
bodyColorstring from themenonetrue
tableBodysarray of object(of any key)nonetrue
tableHeadarray of stringnonetrue
handleRowClickfunctionnonefalse
 

export const { Table, } = Components(theme);
<Table 
	tableBodys={[
		{
			type: timeline?.event,
			amount: "Todays's daye",
			frequency:<span>Frequesncy</span>
		}
	]}
	tableHead={["EVENT", "DATE/MONTH",   "STATUS"]}
	handleRowClick={(e) => console.log(e)}
	headColor={"Black.default"}
	headBgColor={"transparent.default"}
	bodyColor={"Black.80"}
/>

VERSIONING

VersionUpdateDefault
6.0.3Dropdown search works with dropdown values
6.0.5Added Tabs component Switch component
6.0.6Conditionally added toUpperCase from dropdown head
9.0.0Conditionally added toUpperCase fif the searchField is set to true
9.1.0Tab compoentn can now take - JS Element as tabs name - Children is no longer allowed, rather array of object containing head and body is expected.
9.1.1Fixed label type for tab component. Changed the type from string to any
10.5.1Added click event to specified table body data head
10.6.1To the handleRowTabClick handler, added the active row clicked

Verision 9.1.2

  1. Fixed active state for tab

Verision 9.1.5

  1. Fixed type issue

Verision 9.1.10

  1. Added Modal ref type

Verision 9.1.12

  1. Fixed table unique key on every render

Verision 9.1.13

  1. Fixed active state not showing

Verision 9.1.16

  1. Added reValidate props to switch for reValidating

Verision 9.1.17

  1. Added loaderSize props to button for controlling the loader icon size

Verision 9.1.19

  1. Updated Accordion data types from
	[{
        details: any;
        head: any;
        key: number;
    }];

	to 
	{
        details: any;
        head: any;
        key: number;
    }[];

Verision 10.0.0

  1. Added AccordionMultiType component

    Verision 10.0.1

  2. Centered button loader on loading state

    Verision 10.0.2

  3. Made input value either string or number

Verision 10.0.11

  1. Fixed modal ref issue

    Verision 10.0.14

  2. Fixed Dropdown search position

    Verision 10.1.0

  3. Added mobile view direction to modal. Default: down

10.6.1

12 days ago

10.5.1

12 days ago

10.4.1

19 days ago

10.3.0

25 days ago

10.3.1

25 days ago

10.2.0

25 days ago

10.1.5

26 days ago

10.1.0

2 months ago

10.1.1

2 months ago

10.1.2

2 months ago

10.1.3

2 months ago

10.0.14

2 months ago

10.0.13

2 months ago

10.0.5

7 months ago

10.0.6

7 months ago

10.0.7

7 months ago

10.0.8

7 months ago

10.0.9

7 months ago

10.0.0

9 months ago

10.0.1

7 months ago

10.0.2

7 months ago

10.0.3

7 months ago

10.0.4

7 months ago

10.0.12

7 months ago

10.0.11

7 months ago

10.0.10

7 months ago

9.1.19

9 months ago

9.1.17

11 months ago

9.1.18

11 months ago

9.1.16

11 months ago

9.1.13

12 months ago

9.1.14

12 months ago

9.1.15

12 months ago

9.1.10

12 months ago

9.1.11

12 months ago

9.1.12

12 months ago

9.1.1

1 year ago

9.1.0

1 year ago

9.1.9

1 year ago

9.1.8

1 year ago

9.1.7

1 year ago

9.1.6

1 year ago

9.1.5

1 year ago

9.1.4

1 year ago

9.1.3

1 year ago

9.1.2

1 year ago

6.0.3

1 year ago

6.0.5

1 year ago

6.0.4

1 year ago

9.0.0

1 year ago

6.0.2

1 year ago

8.0.12

1 year ago

8.0.11

1 year ago

8.0.9

2 years ago

8.0.8

2 years ago

8.0.5

2 years ago

8.0.7

2 years ago

8.0.6

2 years ago

8.0.10

2 years ago

6.0.1

2 years ago

7.0.1

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

8.0.3

2 years ago

7.0.0

2 years ago

6.1.0

2 years ago

6.3.0

2 years ago

6.5.0

2 years ago

6.6.0

2 years ago

6.8.0

2 years ago

5.0.0

2 years ago

6.0.0

2 years ago

6.2.0

2 years ago

6.4.0

2 years ago

6.7.0

2 years ago

6.5.2

2 years ago

6.5.1

2 years ago

6.5.4

2 years ago

6.5.3

2 years ago

4.5.0

2 years ago

4.4.0

2 years ago

4.3.0

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

4.1.0

2 years ago

4.0.0

2 years ago

3.10.0

2 years ago

3.9.0

2 years ago

3.8.0

2 years ago

3.7.0

2 years ago

3.6.0

2 years ago

3.5.0

2 years ago

3.4.0

2 years ago

3.3.0

2 years ago

3.2.0

2 years ago

3.1.3

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.6.1

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.5

2 years ago

1.4.3

2 years ago

1.4.1

2 years ago

1.4.2

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.2.1

2 years ago

1.1.1

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago