@a24z/alexandria-ui
v0.0.4
Published
React UI library for Alexandria components with themed-markdown support
Maintainers
Readme
@a24z/alexandria-ui
React UI library for Alexandria components with themed-markdown support. This library provides a complete set of UI components for building Alexandria-based applications that can be used across web and Electron environments.
Installation
npm install @a24z/alexandria-ui @a24z/core-library themed-markdown
# or
yarn add @a24z/alexandria-ui @a24z/core-library themed-markdown
# or
pnpm add @a24z/alexandria-ui @a24z/core-library themed-markdownQuick Start
Web Application
import { Alexandria, AlexandriaThemeProvider } from '@a24z/alexandria-ui';
import {
ReadingRecordManager,
LocalStorageReadingRecordAdapter
} from '@a24z/core-library';
function App() {
const storageManager = new ReadingRecordManager({
adapter: new LocalStorageReadingRecordAdapter()
});
return (
<AlexandriaThemeProvider theme="github-dark">
<Alexandria
storageManager={storageManager}
apiUrl="https://api.alexandria.com"
/>
</AlexandriaThemeProvider>
);
}Electron Application
import { Alexandria, AlexandriaThemeProvider } from '@a24z/alexandria-ui';
import {
ReadingRecordManager,
ElectronStorageAdapter
} from '@a24z/core-library';
function ElectronApp() {
const storageManager = new ReadingRecordManager({
adapter: new ElectronStorageAdapter()
});
return (
<AlexandriaThemeProvider theme="github-dark">
<Alexandria
storageManager={storageManager}
apiUrl="http://localhost:8741" // Local server
/>
</AlexandriaThemeProvider>
);
}Available Components
Core Components
Alexandria- Complete Alexandria applicationAlexandriaThemeProvider- Theme provider wrapper using themed-markdown
Individual Components
RepositoryViewer- Repository content viewerRepositoryCard- Repository information cardBookmarkedDocuments- Bookmarked documents managerViewDisplay- Content display componentThemeToggle- Theme switching componentEmptyState- Empty state displayAnimatedBookIcon- Animated book iconFontScaleControls- Font size controlsProductShowcase- Product showcase component
UI Primitives
All base UI components from components/ui are exported and available for use.
Theming
This library uses themed-markdown for consistent theming. All components automatically adapt to the theme provided through AlexandriaThemeProvider.
Available Themes
github-darkgithub-lightmonokaidracula- And more from themed-markdown
Custom Theme Usage
import { AlexandriaThemeProvider } from '@a24z/alexandria-ui';
function App() {
return (
<AlexandriaThemeProvider theme="monokai">
{/* Your app content */}
</AlexandriaThemeProvider>
);
}Development
Setup
# Install dependencies
npm install
# Run development build with watch
npm run dev
# Build library
npm run build
# Run Storybook for component development
npm run storybook
# Run tests
npm test
# Type checking
npm run typecheck
# Linting
npm run lintProject Structure
@a24z/alexandria-ui/
├── src/
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities and API clients
│ └── index.ts # Main exports
├── stories/ # Storybook stories
├── .storybook/ # Storybook configuration
└── dist/ # Build outputArchitecture
See alexandria-library-architecture.md for detailed architecture documentation.
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
