@sirsluginston/sharedui
v2.0.29
Published
Server-Driven UI component library for SirSluginston Co projects
Downloads
2,543
Maintainers
Readme
@sirsluginston/sharedui
Server-Driven UI component library for SirSluginston Co.
Installation
npm install @sirsluginston/shareduiPeer Dependencies:
npm install react react-domQuick Start
import { StatePage, applyTheme } from '@sirsluginston/sharedui';
import '@sirsluginston/sharedui/dist/style.css';
// Apply brand theme
applyTheme({
primaryColor: '#1a365d',
secondaryColor: '#2d3748',
accentColor: '#319795'
});
// Render a page
function App() {
return (
<StatePage
brand={brandConfig}
data={stateData}
/>
);
}Exports
Page Templates (Primary)
Pre-composed pages for SDUI rendering:
| Template | Description |
|----------|-------------|
| NationPage | Nation-level overview with state directory |
| StatePage | State-level with cities directory + recent events |
| CityPage | City-level with companies directory + recent events |
| CompanyPage | Company profile with sites + event history |
| SitePage | Individual site (e.g., "Walmart #1234") |
Block Components
Composable sections for custom pages:
Hero- Title, breadcrumbs, score badgeStatGrid- Statistics cards gridDirectory- Searchable entity list (cities, companies, etc.)RecentEvents- Event/incident feedFilterSidebar- Left sidebar with filtersInfoSidebar- Right sidebar with metadata + ad slotAdSlot- Placeholder for advertisementsMobileAdBanner- Sticky bottom banner for mobile
Layout Components
Shell- Page wrapper (header, footer, theming)Header- Brand navigation headerFooter- Copyright and links
Core UI Components
Button,Card,Badge,InputTable,Modal,Alert,TabsTooltip,Spinner,Skeleton
Hooks & Utilities
useTheme()- Dark mode toggle hookapplyTheme(config)- Apply brand colors to CSS variables
Types
Full TypeScript definitions exported:
BrandConfig- Brand configurationNationPageData,StatePageData,CityPageData, etc.EntityStats,DirectoryItem,RecentEvent
Theming
SharedUI uses CSS variables for theming. Override at runtime:
import { applyTheme } from '@sirsluginston/sharedui';
applyTheme({
primaryColor: '#your-primary',
secondaryColor: '#your-secondary',
accentColor: '#your-accent'
});Or override in CSS:
:root {
--primary-color: #custom;
--accent-color: #custom;
}Responsive Layout
The page-layout CSS class provides:
- Desktop (>1400px): 3-column grid (filters | main | info)
- Tablet (992-1400px): 2-column (main | info)
- Mobile (<992px): Single column + sticky ad banner
Development
# Install dependencies
npm install
# Start dev server with demo
npm run dev
# Build library
npm run buildLicense
MIT © SirSluginston Co