Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion config/rollup.config.dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import replace from '@rollup/plugin-replace';
import serve from 'rollup-plugin-serve';
import externals from './externals.mjs';

const paths = {
Expand All @@ -10,7 +11,7 @@ const paths = {
outputFile: 'docs/static/lib/index.js',
},
playground: {
input: 'playground/src/index.jsx',
input: 'playground/src/index.tsx',
outputFile: 'docs/static/index.js',
},
};
Expand Down Expand Up @@ -62,5 +63,9 @@ export default [{
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('development'),
}),
serve({
contentBase: 'docs',
port: 8001,
}),
],
}];
2 changes: 1 addition & 1 deletion config/rollup.config.docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const paths = {
outputFile: 'docs/static/lib/index.js',
},
playground: {
input: 'playground/src/index.jsx',
input: 'playground/src/index.tsx',
outputFile: 'docs/static/index.js',
},
};
Expand Down
71 changes: 71 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,77 @@
<link rel="icon" href="static/favicon.ico"/>
<title>react-double-marquee</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<style>
html, body, #root { margin: 0; height: 100%; }
body { font-family: 'Roboto', sans-serif; }
.page {
display: flex;
flex-direction: column;
align-items: center;
min-height: 100%;
box-sizing: border-box;
background-color: #efefef;
}
.examples {
width: 100%;
max-width: 900px;
padding: 20px 15px;
border-top: 1px solid rgba(221, 221, 221, 1);
box-sizing: border-box;
}
.header {
display: flex;
flex-direction: column;
align-items: center;
margin: 20px;
}
.header__logo { width: 400px; max-width: 100%; }
.header__npm {
margin-top: 12px;
font-size: 14px;
color: #4a5a6a;
text-decoration: none;
border-bottom: 1px dashed #4a5a6a;
}
.header__npm:hover { color: #2a3a4a; }
.card {
display: flex;
flex-wrap: wrap;
align-items: center;
margin-bottom: 20px;
}
.card__description {
width: 250px;
padding: 10px 15px;
color: #dddddd;
background-color: #4a5a6a;
box-shadow: 3px 3px 6px rgba(45, 45, 90, 0.35);
box-sizing: border-box;
}
.card__props {
margin: 8px 0 0;
padding: 8px;
background-color: #2a3a4a;
color: #c8e4ff;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 12px;
white-space: pre-wrap;
word-break: break-all;
}
.card__marquee-outer {
width: 250px;
margin: 15px;
flex-grow: 1;
background-color: #cccccc;
border-radius: 2px;
box-shadow: 3px 3px 6px rgba(45, 45, 90, 0.35);
}
.card__marquee-inner {
width: 200px;
margin: 20px;
white-space: nowrap;
}
</style>
</head>
<body>
<noscript>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"react": "^18.3.0",
"react-dom": "^18.3.0",
"rollup": "^4.0.0",
"rollup-plugin-serve": "^3.0.0",
"semantic-release": "^24.0.0",
"ts-jest": "^29.1.0",
"tslib": "^2.6.0",
Expand Down
80 changes: 0 additions & 80 deletions playground/src/components/ExampleCard.jsx

This file was deleted.

23 changes: 23 additions & 0 deletions playground/src/components/ExampleCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ReactElement } from 'react';
import type { MarqueeProps } from '../../../src';

interface ExampleCardProps {
description: string;
marqueeComponent: ReactElement<MarqueeProps>;
}

export default function ExampleCard({ description, marqueeComponent }: ExampleCardProps) {
return (
<div className="card">
<div className="card__description">
<div>{description}</div>
<pre className="card__props">
{JSON.stringify({ props: marqueeComponent.props }, null, 2)}
</pre>
</div>
<div className="card__marquee-outer">
<div className="card__marquee-inner">{marqueeComponent}</div>
</div>
</div>
);
}
33 changes: 0 additions & 33 deletions playground/src/components/Header.jsx

This file was deleted.

15 changes: 15 additions & 0 deletions playground/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default function Header() {
return (
<header className="header">
<img className="header__logo" src="static/logo.png" alt="react-double-marquee logo" />
<a
className="header__npm"
href="https://www.npmjs.com/package/react-double-marquee"
target="_blank"
rel="noopener noreferrer"
>
npm install react-double-marquee
</a>
</header>
);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import Marquee from '../../../docs/static/lib';
import Marquee from '../../../src';
import ExampleCard from '../components/ExampleCard';

function DefaultLeftMarquee() {
export default function DefaultLeftMarquee() {
return (
<ExampleCard
description="Default - Left"
Expand All @@ -14,5 +13,3 @@ function DefaultLeftMarquee() {
/>
);
}

export default DefaultLeftMarquee;
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import Marquee from '../../../docs/static/lib';
import Marquee from '../../../src';
import ExampleCard from '../components/ExampleCard';

function DefaultRightMarquee() {
export default function DefaultRightMarquee() {
return (
<ExampleCard
description="Default - Right"
Expand All @@ -14,5 +13,3 @@ function DefaultRightMarquee() {
/>
);
}

export default DefaultRightMarquee;
15 changes: 15 additions & 0 deletions playground/src/examples/LoopMarquee.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Marquee from '../../../src';
import ExampleCard from '../components/ExampleCard';

export default function LoopMarquee() {
return (
<ExampleCard
description="Stop after a fixed number of loops"
marqueeComponent={(
<Marquee loop={3} delay={0}>
This stops after 3 loops
</Marquee>
)}
/>
);
}
15 changes: 15 additions & 0 deletions playground/src/examples/PauseOnHoverMarquee.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Marquee from '../../../src';
import ExampleCard from '../components/ExampleCard';

export default function PauseOnHoverMarquee() {
return (
<ExampleCard
description="Pause on hover"
marqueeComponent={(
<Marquee pauseOnHover delay={0}>
Hover me to pause the scroll
</Marquee>
)}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import Marquee from '../../../docs/static/lib';
import Marquee from '../../../src';
import ExampleCard from '../components/ExampleCard';

function ShortMarquee() {
export default function ShortMarquee() {
return (
<ExampleCard
description="Scroll only on overflow"
Expand All @@ -14,5 +13,3 @@ function ShortMarquee() {
/>
);
}

export default ShortMarquee;
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import Marquee from '../../../docs/static/lib';
import Marquee from '../../../src';
import ExampleCard from '../components/ExampleCard';

function ShortScrollingMarquee() {
export default function ShortScrollingMarquee() {
return (
<ExampleCard
description="Default - Short text scrolls"
Expand All @@ -14,5 +13,3 @@ function ShortScrollingMarquee() {
/>
);
}

export default ShortScrollingMarquee;
Loading
Loading