1.0.51 • Published 8 months ago

@flavioespinoza/salsa-ui v1.0.51

Weekly downloads
-
License
MIT*
Repository
github
Last release
8 months ago

salsa-ui

Reusable component library for React 18 + Tailwind CSS, designed for internal and public use across Salsa Network web projects.

šŸ“¦ Published as @flavioespinoza/salsa-ui


šŸš€ Overview

salsa-ui is a modern, accessible, and theme-ready React UI library built with Tailwind CSS.

It includes:

  • 🧱 Components like Button, Input, Card, Popover, and more
  • šŸŽØ Icons designed to match the Salsa design system
  • āš›ļø Compatible with React 18+ and frameworks like Next.js
  • šŸ“¦ Distributed as an ES6 module for modern bundlers

šŸ“š Documentation

šŸ“– Full documentation and usage examples:
āž”ļø https://flavioespinoza.github.io/salsa-ui


ā–¶ļø Run Locally

Install dependencies:

yarn install

Start the project:

yarn dev

Open http://localhost:3000 in your browser.

/public/Macbook-Pro-16-1727.998046875x1116.9921875.png


🧩 Main Layout, Side Nav, and Menu Items

This is the layout system used by most pages in the project. The MainLayout component wraps every page.tsx and includes the SideNav and Header. These layout components are not exported from the NPM module and are expected to be copied into your project directly.

šŸ“ Example structure:

  • src/components/main-layout.tsx
  • src/constants/menu-items.tsx

You will need two sets of menu items: menuItems (top section) and menuItemsFooter (bottom section).

Note: Here's the relevant import in main-layout.tsx:

import { menuItems, menuItemsFooter } from '@/constants/menu-items'

šŸ”§ MainLayout example:

src/components/main-layout.tsx

'use client'

import React from 'react'
import { Header } from '@/components/ui/header'
import SideNav from '@/components/ui/side-nav'
import { menuItems, menuItemsFooter } from '@/constants/menu-items'
import useSidenav from '@/hooks/useSidenav'
import { useSideNavStore } from '@/state/use-side-nav-store'

const HEADER_HEIGHT = 'h-[74px]'

interface MainLayoutProps {
	children: React.ReactNode
}

const MainLayout: React.FC<MainLayoutProps> = ({ children }) => {
	useSidenav()
	const { width } = useSideNavStore()

	return (
		<div id="mainLayoutWrapper" className="flex min-h-screen w-full">
			<SideNav menuItems={menuItems} menuItemsFooter={menuItemsFooter} />
			<div
				id="mainLayoutContent"
				className="flex flex-1 flex-col transition-all duration-300"
			>
				<Header height={HEADER_HEIGHT} />
				<main className="flex-1 p-4">{children}</main>
			</div>
		</div>
	)
}

export { MainLayout }
export default MainLayout

šŸ“„ Page example:

src/app/<route-folder>/page.tsx

import React from 'react'
import { MainLayout } from '@/components/main-layout'

export default function Page() {
	return (
		<MainLayout>
			<h1 className="text-lg font-bold">Page</h1>
			<p>This is the page content.</p>
		</MainLayout>
	)
}

Using @flavioespinoza/salsa-ui in your project

šŸ“¦ Installation

Yarn

yarn add @flavioespinoza/salsa-ui

NPM

npm install @flavioespinoza/salsa-ui

šŸŽØ Salsa UI CSS

If you are using Next.js add this line to your src/app/layout.tsx file. If you are using crate react app add it to your src/index.tsx file.

import '@flavioespinoza/salsa-ui/dist/index.css'

šŸŽØ Tailwind Configuration

Update your tailwind.config.js:

module.exports = {
	content: [
		'./src/**/*.{js,ts,jsx,tsx}',
		'./node_modules/@flavioespinoza/salsa-ui/**/*.{js,ts,jsx,tsx}'
	],
	theme: {
		extend: {}
	},
	plugins: []
}

šŸ› ļø Development

  • UI components live in src/components/ui
  • Docs are stored in docs/ and powered by Docsify
  • To preview docs locally:
npx docsify-cli serve docs

šŸš€ NPM Publishing

Publishing is automated via GitHub Actions when the main branch is updated.

To publish manually:

# Patch bump (1.0.8 → 1.0.9)
npm version patch

# Or use:
# npm version minor   # 1.1.0
# npm version major   # 2.0.0

git push && git push --tags

# npm publish --access public --otp=<six-digit-code-from-your-2FA-authenticator-app>

npm publish --access public --otp=

šŸ”’ License

MIT Ā© Flavio Espinoza

1.0.51

8 months ago

1.0.50

8 months ago

1.0.49

8 months ago

1.0.48

8 months ago

1.0.47

8 months ago

1.0.45

8 months ago

1.0.44

8 months ago

1.0.43

8 months ago

1.0.41

8 months ago

1.0.40

8 months ago

1.0.39

8 months ago

1.0.38

8 months ago

1.0.37

8 months ago

1.0.36

8 months ago

1.0.35

8 months ago

1.0.34

8 months ago

1.0.32

8 months ago

1.0.31

8 months ago

1.0.30

8 months ago

1.0.29

8 months ago

1.0.28

8 months ago

1.0.27

8 months ago

1.0.26

8 months ago

1.0.24

8 months ago

1.0.23

8 months ago

1.0.22

8 months ago

1.0.21

8 months ago

1.0.20

8 months ago

1.0.19

8 months ago

1.0.18

8 months ago

1.0.17

8 months ago

1.0.16

8 months ago

1.0.15

8 months ago

1.0.14

8 months ago

1.0.13

8 months ago

1.0.12

8 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago