1.0.9 • Published 11 months ago

@holmesdev/sync v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

SYNC COMPONENTS

Add some flair to your projects by trying our dazzling yet practical Button & Alert components! Built with user interactivity and accessibility in mind, choose from an array of themes/variant types pertaining to each level of action severity, along with customizable options to tailor and enhance the functionality of each component.

Check out our documentation site for visuals of our components.

Table of Contents (Sticky)

Installation

Run either of these commands inside the terminal:

  $ npm install @holmesdev/sync
  $ yarn add @holmesdev/sync

!IMPORTANT > Styled-components is the JavaScript CSS library used to build our components. To ensure that they work as intended, you will need to separately install styled-components within both the devDependencies & peerDependencies inside of your package.json upon installation of the package.

You MUST also ensure that you are:

  • Using React.js v18.3.1 or higher
  • Using styled-components v6.1.13 or higher

Latest Package Version

NameVersion
@holmesdev/syncNPM

Install the latest package version if required:

  $ npm install @holmesdev/sync@latest
  $ yarn add @holmesdev/sync@latest

Usage

Import the components (together or separately, depending on usage) inside your project:

import { Button, Alert, AlertDialog } from "@holmesdev/sync";

Button Component

A Button that allows the user to trigger an action when clicked. It comes with a selection of themes/variants.

import { Button } from "@holmesdev/sync";

<Button
  variant="primary"
  hoverColor="#1f56ec"
  path="https://sync-documentation.onrender.com/"
>
  Click Me
</Button>

_________________________________________________

//BUTTON STATUS EXAMPLES:

<Button
  variant="success"
  hoverColor="#1cd560"
  type = "submit"
>
  Success Action
</Button>

Alert Component

An Alert box that appears on the page with a status notification or an action request. It comes with a selection of themes/statuses.

import { Alert } from "@holmesdev/sync";

<Alert
  title="Success!"
  body="Your action was completed successfully."
  status="success"
/>

________________________________________________

//ALERT STATUS EXAMPLES:

<div>

// Success Alert
<Alert
  title="Success!"
  body="Your action was completed successfully."
  status="success"
/>

// Error Alert
<Alert
  title="Error!"
  body="Something went wrong. Please try again."
  status="error"
/>

// Warning Alert
<Alert
  title="Warning!"
  body="Be careful! This action could have consequences."
  status="warning"
/>

AlertDialog Component

The role of AlertDialog is to "link" the Alert & Button components together, as well as toggling the visibility of the Alert on the page.

import { AlertDialog } from "@holmesdev/sync";

<AlertDialog
  title="Success!"
  body="Your action was completed successfully."
  status="success"
  buttonVariant="success"
  btnColor="#28a745"
  hoverColor="#218838"
>
  Show Success
</AlertDialog>

________________________________________________

//ALERTDIALOG STATUS EXAMPLES:

<AlertDialog
  title="Error"
  body="Something went wrong. Please try again."
  status="danger"
  buttonVariant="warning"
  btnColor="#dc3545"
  hoverColor="#c82333"
>
  Show Error
</AlertDialog>

Props

Button Component

PropTypeRequiredDescription
childrenstringYesText or content inside the Button.
variantstringNoButton style. Options: default, primary, success, warning.
hoverColorstringNoColor displayed on hover.
pathstringNoURL path if the button is used as a link.
typestringNoButton type attribute. Options: button, submit, reset. Default is button.
onClickfunctionYesCallback function for the button click event.

Alert Component

PropTypeRequiredDescription
titlestringYesContent to be displayed inside the Alert.
statusstringYesAlert type. Options: default, primary, success, warning, defaultDark, primaryDark, successDark, warningDark.
bodystringYesBody text displayed inside the Alert.

AlertDialog Component

PropTypeRequiredDescription
titlestringYesTitle text displayed inside the component.
bodystringYesBody text displayed inside the component.
childrenstringYesThe child elements of the button component.
btnColorstringYesSpecifies the X close button's color.
ariaLabelstringNoAccessibility label for screen readers, describing the purpose of the dialog.
statusenumYesSpecifies the visual theme – Options: ["default", "primary", "success", "warning", "defaultDark", "primaryDark", "successDark", "warningDark"].
buttonVariantenumYesSpecifies the Button's variant – Options: ["default", "primary", "success", "warning"].
isOpenbooleanNoIf true, the component is open; if false, the component isn't open.
onClosefunctionNoCalled when the component is closed.

Themes

Light Themes

  • default: Gradient border with a white background
  • primary: Blue border with a white background
  • success: Green border with a white background
  • warning: Red border with a white background

Dark Themes

  • defaultDark: Gradient border with a black background
  • primaryDark: Blue border with a black background
  • successDark: Green border with a black background
  • warningDark: Red border with a black background

Customization

  • title & body text is customizable for each component
  • variant & status need to be specified, with no further CSS customization being necessary

Accessibility

  • ARIA attributes implemented
  • Color contrast compliant

License

MIT License

Available for open-source consumption under MIT licensing. See MIT License for more information.

1.0.2

12 months ago

1.0.9

11 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.0

1 year ago