npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

carone-react

v1.2.45

Published

A React library for simple web projects

Downloads

337

Readme

carone-react

A React library for simple web projects. This library is a collection of components that can be used to build simple web projects quick. The library is built using React and styled-components.

Installation

To install the library, you can use npm:

npm install carone-react

Usage

To use the library, you can import the components from the library and use them in your project. Here is an example of how you can use the Button component:

import React from 'react';
import { Button } from 'carone-react';

const App = () => {
	return (
		<Button onClick={() => {}} text="Click me" />
	);
};

Each component has their own props that you can use to customize the component. Not every component can be used directly. Some components are built to be used with other components. For example, the Header component is built to be used inside a Page component. You can find more information about how to use these components in the Components section.

Without proper configuration, the components will not look good because no styling is applied. It is recommended to wrap your app in a CaroneProvider to configure the default style values of the application.

import React from 'react';
import { CaroneProvider } from 'carone-react';
import { Button } from 'carone-react';

const App = () => {
	return (
		<CaroneProvider>
			<Button onClick={() => {}} text="Click me" />
		</CaroneProvider>
	);
};

If you wrap your app in a CaroneProvider, the application will have a default styling set. It is of course possible to customize these styles by passing a config property to the CaroneProvider. All properties of this config object are optional, and if not provided, default values will be used. The CaroneConfig object has the following properties:

  • colors: An object with the following properties:
    • main: The main color of the application.
    • secondary: The secondary color of the application.
    • error: The error color of the application.
    • success: The success color of the application.
    • font: The font color of the application.
    • fontOnMain: The font color on the main color of the application.
  • fonts: An object with the following properties:
    • mainFont: The main font (family) of the application.
    • titleFont: The title font (family) of the application.
    • sizes: An object with the following properties:
      • small: The small font size of the application.
      • default: The default font size of the application.
      • large: The large font size of the application.
      • subtitle: The subtitle font size of the application.
      • title: The title font size of the application.
  • sizes: An object with the following properties:
    • padding: An object with the following properties:
      • xxs: The extra extra small padding of the application.
      • xs: The extra small padding of the application.
      • sm: The small padding of the application.
      • md: The medium padding of the application.
      • lg: The large padding of the application.
      • xl: The extra large padding of the application.
      • xxl: The extra extra large padding of the application.
    • borderRadius: An object with the following properties:
      • small: The small border radius of the application.
      • medium: The medium border radius of the application.
      • large: The large border radius of the application.

Here is an example of how you can customize the default styles of the application (the default values are shown as an example):

import React from 'react';
import { CaroneProvider, CaroneConfig } from 'carone-react';
import { Button } from 'carone-react';

const App = () => {
	const config: CaroneConfig = {
		colors: {
			main: 'blue',
			secondary: 'black',
			error: 'red',
			success: 'green',
			font: 'green',
			fontOnMain: 'white',
		},
		fonts: {
			mainFont: 'Verdana',
			titleFont: 'Arial',
			sizes: {
				small: '0.8rem',
				default: '1rem',
				large: '1.5rem',
				subtitle: '1.8rem',
				title: '3rem',
			}
		},
		sizes: {
			padding: {
				xxs: '0.1rem',
				xs: '0.2rem',
				sm: '0.5rem',
				md: '1rem',
				lg: '1.5rem',
				xl: '2rem',
				xxl: '3rem',
			},
			borderRadius: {
				small: '0.2rem',
				medium: '0.5rem',
				large: '1rem',
			}
		}
	};

	return (
		<CaroneProvider config={config}>
			<Button onClick={() => {}} text="Click me" />
		</CaroneProvider>
	);
};

Now the application will have the custom styles set and the components will look according to your style.

If you need to access the theme in your components, you can use the useConfig hook. This hook will return the CaroneConfig object that is used in the application.

import React from 'react';
import { useConfig } from 'carone-react';

const MyComponent = () => {
	const config = useConfig();

	return (
		<div style={{ color: config.colors!.main }}>
			Hello world!
		</div>
	);
};

Additionally, you can also use enums to access your style values. The CaroneConfig object has the following enums:

  • Color: An enum with the following properties:
    • MAIN: The main color of the application.
    • SECONDARY: The secondary color of the application.
    • ERROR: The error color of the application.
    • SUCCESS: The success color of the application.
    • FONT: The font color of the application.
    • FONTONMAIN: The font color on the main color of the application.
  • Size: An enum with the following properties:
    • XXS: The small font size of the application.
    • XS: The extra small font size of the application.
    • SM: The small font size of the application.
    • MD: The medium font size of the application.
    • LG: The large font size of the application.
    • XL: The extra large font size of the application.
    • XXL: The extra extra large font size of the application.
  • FontSize: An enum with the following properties:
    • SMALL: The small font size of the application.
    • DEFAULT: The default font size of the application.
    • LARGE: The large font size of the application.
    • SUBTITLE: The subtitle font size of the application.
    • TITLE: The title font size of the application.
  • BorderRadius: An enum with the following properties:
    • SMALL: The small border radius of the application.
    • MEDIUM: The medium border radius of the application.
    • LARGE: The large border radius of the application.

Here is an example of how you can use the enums to access your style values:

import React from 'react';
import { useConfig, Colors } from 'carone-react';

const MyComponent = () => {
	const config = useConfig();

	return (
		<div style={{ color: Color.MAIN }}>
			Hello world!
		</div>
	);
};

Components

To be written...