Skip to content

Commit

Permalink
improve examples
Browse files Browse the repository at this point in the history
  • Loading branch information
KingSora committed Jul 29, 2024
1 parent cbed79d commit c68096a
Show file tree
Hide file tree
Showing 25 changed files with 119 additions and 111 deletions.
5 changes: 3 additions & 2 deletions examples/angular/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const initBodyOverlayScrollbars = (force?: boolean) =>
{
scrollbars: {
theme: 'os-theme-light',
clickScroll: true,
},
}
).state().destroyed;
Expand All @@ -29,7 +30,7 @@ const initBodyOverlayScrollbars = (force?: boolean) =>
OverlayScrollbars Ngx
</a>
</h1>
<section class="slot">
<section>
<div
overlay-scrollbars
#osRef
Expand Down Expand Up @@ -77,7 +78,7 @@ const initBodyOverlayScrollbars = (force?: boolean) =>
<p class="title">Events:</p>
<div class="items">
<div
*ngFor="let observedEvent of observedEvents$ | async | keyvalue: originalOrder"
*ngFor="let observedEvent of observedEvents$ | async | keyvalue : originalOrder"
[ngClass]="{ event: true, active: observedEvent.value.active }"
>
{{ observedEvent.key }}
Expand Down
4 changes: 3 additions & 1 deletion examples/angular/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { OverlayScrollbars, ClickScrollPlugin } from 'overlayscrollbars';
import { AppModule } from './app/app.module';

OverlayScrollbars.plugin(ClickScrollPlugin);

platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
20 changes: 8 additions & 12 deletions examples/angular/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,30 +104,26 @@ img {
height: 100%;
}

.slot {
border-radius: 6px;
.overlayscrollbars-ngx {
width: 16rem;
height: 16rem;
margin: 0 auto;
flex: none;
}

.overlayscrollbars-ngx {
width: 100%;
height: 100%;
resize: both;
overflow: auto;
border: 2px solid var(--foreground-color);
border-radius: 6px;
border: 2px solid var(--foreground-color);
box-shadow: rgb(var(--foreground-color-rgb) / 0.14) 0 0.875rem 3.125rem;
}

.logo {
width: 180%;
height: 180%;
width: 32rem;
height: 32rem;
padding: 1rem;
display: inline-block;
display: block;
pointer-events: none;
user-select: none;
backdrop-filter: brightness(88%) contrast(1.012);
margin: 0 auto;
}

.title {
Expand Down
2 changes: 1 addition & 1 deletion examples/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1>
OverlayScrollbars
</a>
</h1>
<section class="slot">
<section>
<div id="target" class="overlayscrollbars" data-overlayscrollbars-initialize>
<div id="targetContent" class="logo">
<img alt="Logo" src="logo.png" width="333" height="333" />
Expand Down
11 changes: 9 additions & 2 deletions examples/browser/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
const { OverlayScrollbars } = OverlayScrollbarsGlobal;
const { OverlayScrollbars, ClickScrollPlugin } = OverlayScrollbarsGlobal;

OverlayScrollbars(document.body, {});
// optional: use the ClickScrollPlugin to make the option "scrollbars.clickScroll: true" available
OverlayScrollbars.plugin(ClickScrollPlugin);

OverlayScrollbars(document.body, {
scrollbars: {
clickScroll: true,
},
});
OverlayScrollbars(document.getElementById('target'), {});
20 changes: 8 additions & 12 deletions examples/browser/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,26 @@ img {
height: 100%;
}

.slot {
border-radius: 6px;
.overlayscrollbars {
width: 16rem;
height: 16rem;
margin: 0 auto;
flex: none;
}

.overlayscrollbars {
width: 100%;
height: 100%;
resize: both;
overflow: auto;
border: 2px solid var(--foreground-color);
border-radius: 6px;
border: 2px solid var(--foreground-color);
box-shadow: rgb(var(--foreground-color-rgb) / 0.14) 0 0.875rem 3.125rem;
}

.logo {
width: 180%;
height: 180%;
width: 32rem;
height: 32rem;
padding: 1rem;
display: inline-block;
display: block;
pointer-events: none;
user-select: none;
backdrop-filter: brightness(88%) contrast(1.012);
margin: 0 auto;
}

.title {
Expand Down
2 changes: 1 addition & 1 deletion examples/node/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1>
OverlayScrollbars
</a>
</h1>
<section class="slot">
<section>
<div id="target" class="overlayscrollbars" data-overlayscrollbars-initialize>
<div id="targetContent" class="logo">
<img alt="Logo" src="logo.png" width="333" height="333" />
Expand Down
11 changes: 9 additions & 2 deletions examples/node/src/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import 'overlayscrollbars/overlayscrollbars.css';
import { OverlayScrollbars } from 'OverlayScrollbars';
import { OverlayScrollbars, ClickScrollPlugin } from 'OverlayScrollbars';

OverlayScrollbars(document.body, {});
// optional: use the ClickScrollPlugin to make the option "scrollbars.clickScroll: true" available
OverlayScrollbars.plugin(ClickScrollPlugin);

OverlayScrollbars(document.body, {
scrollbars: {
clickScroll: true,
},
});
OverlayScrollbars(document.getElementById('target'), {});
20 changes: 8 additions & 12 deletions examples/node/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,26 @@ img {
height: 100%;
}

.slot {
border-radius: 6px;
.overlayscrollbars {
width: 16rem;
height: 16rem;
margin: 0 auto;
flex: none;
}

.overlayscrollbars {
width: 100%;
height: 100%;
resize: both;
overflow: auto;
border: 2px solid var(--foreground-color);
border-radius: 6px;
border: 2px solid var(--foreground-color);
box-shadow: rgb(var(--foreground-color-rgb) / 0.14) 0 0.875rem 3.125rem;
}

.logo {
width: 180%;
height: 180%;
width: 32rem;
height: 32rem;
padding: 1rem;
display: inline-block;
display: block;
pointer-events: none;
user-select: none;
backdrop-filter: brightness(88%) contrast(1.012);
margin: 0 auto;
}

.title {
Expand Down
2 changes: 1 addition & 1 deletion examples/overlayscrollbars/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1>
OverlayScrollbars
</a>
</h1>
<section class="slot">
<section>
<div id="target" class="overlayscrollbars" data-overlayscrollbars-initialize>
<div id="targetContent" class="logo">
<img alt="Logo" src="logo.png" width="333" height="333" />
Expand Down
6 changes: 5 additions & 1 deletion examples/overlayscrollbars/src/bodyOverlayScrollbars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const initBodyOverlayScrollbars = (force?: boolean) =>
body: force ? false : null,
},
},
{}
{
scrollbars: {
clickScroll: true,
},
}
).state().destroyed;

const toggleBodyOverlayScrollbarsSection = document.querySelector(
Expand Down
3 changes: 3 additions & 0 deletions examples/overlayscrollbars/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import 'overlayscrollbars/overlayscrollbars.css';
import { OverlayScrollbars, ClickScrollPlugin } from 'overlayscrollbars';
import './actions.ts';
import './bodyOverlayScrollbars.ts';

OverlayScrollbars.plugin(ClickScrollPlugin);
20 changes: 8 additions & 12 deletions examples/overlayscrollbars/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,26 @@ img {
height: 100%;
}

.slot {
border-radius: 6px;
.overlayscrollbars {
width: 16rem;
height: 16rem;
margin: 0 auto;
flex: none;
}

.overlayscrollbars {
width: 100%;
height: 100%;
resize: both;
overflow: auto;
border: 2px solid var(--foreground-color);
border-radius: 6px;
border: 2px solid var(--foreground-color);
box-shadow: rgb(var(--foreground-color-rgb) / 0.14) 0 0.875rem 3.125rem;
}

.logo {
width: 180%;
height: 180%;
width: 32rem;
height: 32rem;
padding: 1rem;
display: inline-block;
display: block;
pointer-events: none;
user-select: none;
backdrop-filter: brightness(88%) contrast(1.012);
margin: 0 auto;
}

.title {
Expand Down
3 changes: 2 additions & 1 deletion examples/react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const App = () => {
options: {
scrollbars: {
theme: 'os-theme-light',
clickScroll: true,
},
},
});
Expand Down Expand Up @@ -86,7 +87,7 @@ const App = () => {
OverlayScrollbars React
</a>
</h1>
<section className="slot">
<section>
{overlayScrollbarsApplied ? (
<OverlayScrollbarsComponent
className="overlayscrollbars-react"
Expand Down
20 changes: 8 additions & 12 deletions examples/react/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,26 @@ img {
height: 100%;
}

.slot {
border-radius: 6px;
.overlayscrollbars-react {
width: 16rem;
height: 16rem;
margin: 0 auto;
flex: none;
}

.overlayscrollbars-react {
width: 100%;
height: 100%;
resize: both;
overflow: auto;
border: 2px solid var(--foreground-color);
border-radius: 6px;
border: 2px solid var(--foreground-color);
box-shadow: rgb(var(--foreground-color-rgb) / 0.14) 0 0.875rem 3.125rem;
}

.logo {
width: 180%;
height: 180%;
width: 32rem;
height: 32rem;
padding: 1rem;
display: inline-block;
display: block;
pointer-events: none;
user-select: none;
backdrop-filter: brightness(88%) contrast(1.012);
margin: 0 auto;
}

.title {
Expand Down
3 changes: 3 additions & 0 deletions examples/react/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { OverlayScrollbars, ClickScrollPlugin } from 'overlayscrollbars';
import 'overlayscrollbars/overlayscrollbars.css';
import './index.css';
import App from './App';

OverlayScrollbars.plugin(ClickScrollPlugin);

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
<React.StrictMode>
Expand Down
3 changes: 2 additions & 1 deletion examples/solid/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const App: Component = () => {
options: {
scrollbars: {
theme: 'os-theme-light',
clickScroll: true,
},
},
});
Expand Down Expand Up @@ -81,7 +82,7 @@ const App: Component = () => {
OverlayScrollbars Solid
</a>
</h1>
<section class="slot">
<section>
{overlayScrollbarsApplied() ? (
<OverlayScrollbarsComponent
class="overlayscrollbars-solid"
Expand Down
20 changes: 8 additions & 12 deletions examples/solid/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,26 @@ img {
height: 100%;
}

.slot {
border-radius: 6px;
.overlayscrollbars-solid {
width: 16rem;
height: 16rem;
margin: 0 auto;
flex: none;
}

.overlayscrollbars-solid {
width: 100%;
height: 100%;
resize: both;
overflow: auto;
border: 2px solid var(--foreground-color);
border-radius: 6px;
border: 2px solid var(--foreground-color);
box-shadow: rgb(var(--foreground-color-rgb) / 0.14) 0 0.875rem 3.125rem;
}

.logo {
width: 180%;
height: 180%;
width: 32rem;
height: 32rem;
padding: 1rem;
display: inline-block;
display: block;
pointer-events: none;
user-select: none;
backdrop-filter: brightness(88%) contrast(1.012);
margin: 0 auto;
}

.title {
Expand Down
Loading

0 comments on commit c68096a

Please sign in to comment.