text-media
v2.0.10
Published
A lightweight, responsive component for combining text and media content with various layout options.
Readme
Text & Media Layout Component
A lightweight, responsive component for combining text and media content with various layout options.
Features
- Responsive design
- Multiple layout options
- Support for images and videos
- Customizable themes
- Lightweight (2.5KB gzipped)
- No dependencies
- React version available
Installation
npm install text-mediaUsage
Basic Usage
<div class="text-media">
<div class="text-media__text">
<h2>Your Title</h2>
<p>Your content goes here.</p>
</div>
<div class="text-media__image">
<picture>
<img src="your-image.jpg" alt="Description">
</picture>
</div>
</div>React Version
The component is also available as a React component. You can use it in your React applications:
import { TextMedia } from 'text-media-react';
function MyComponent() {
return (
<TextMedia>
<TextMedia.Text>
<h2>Your Title</h2>
<p>Your content goes here.</p>
</TextMedia.Text>
<TextMedia.Image>
<picture>
<img src="your-image.jpg" alt="Description" />
</picture>
</TextMedia.Image>
</TextMedia>
);
}Live Demo
Check out the live demo at https://example.com/demo
React Demo
A React version of the demo is available in the demo directory. To run it:
- Start a local server:
python3 -m http.server 8000The React demo showcases:
- Component integration with React
- Responsive layout
- Image handling
- Custom styling
Options
Layout Options
text-media--reverse: Reverses the order of text and mediatext-media--stack: Stacks text and media verticallytext-media--center: Centers content vertically
Theme Options
text-media--light: Light themetext-media--dark: Dark themetext-media--purple-background: Purple background theme
Development
- Clone the repository
- Install dependencies:
npm install - Run tests:
npm test - Build:
npm run build
License
MIT
