Skip to content

Commit c1bab54

Browse files
committed
fix: fixes
1 parent 0e1f636 commit c1bab54

11 files changed

+11850
-15718
lines changed

CHANGELOG.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
1-
### Changelog
1+
# Changelog
22

33
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7-
#### [v0.0.7](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.7...v0.0.7)
8-
9-
#### [v0.0.7](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.6...v0.0.7)
7+
## [v0.0.7](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.6...v0.0.7)
108

119
> 17 August 2021
1210
1311
- ci: add travis [`7791eb5`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/7791eb519a4f9a806a9ec150c702a8c0de324535)
1412
- fix: declaration file [`29bc378`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/29bc378913af9303ba72247a097de87d3e615fe1)
1513
- docs: update README [`be5ed17`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/be5ed17c9f351fa10974cbea2acb696b0ece997a)
1614

17-
#### [v0.0.6](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.5...v0.0.6)
15+
## [v0.0.6](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.5...v0.0.6)
1816

1917
> 17 August 2021
2018
2119
- fix: declaration file [`493a657`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/493a65707a144ce60da6bc05067f9bdf36fbb4fd)
2220

23-
#### [v0.0.5](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.4...v0.0.5)
21+
## [v0.0.5](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.4...v0.0.5)
2422

2523
> 17 August 2021
2624
2725
- fix: fixes [`9700e13`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/9700e137d7c5b8b62bdd5fea97836c26ea341437)
2826
- test: add jest configuration [`f23a0c6`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/f23a0c61173a036879c6d4505ee5431b19d33685)
2927
- fix: package.json [`8a1c23c`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/8a1c23ccff97e55a17409abe48a609dc20cdfa40)
3028

31-
#### [v0.0.4](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.3...v0.0.4)
29+
## [v0.0.4](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.3...v0.0.4)
3230

3331
> 17 August 2021
3432
3533
- feat: add onScroll function [`cf6f7a0`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/cf6f7a0e0045dff1ea0a856a99e248ce44b6126d)
3634
- fix: CHANGELOG [`fc432be`](https://github.com/ahmnouira/ionic-react-header-parallax/commit/fc432be4f08ec22bd89f0feb7ad9fa7b9e4c9944)
3735

38-
#### [v0.0.3](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.2...v0.0.3)
36+
## [v0.0.3](https://github.com/ahmnouira/ionic-react-header-parallax/compare/v0.0.2...v0.0.3)
3937

4038
> 17 August 2021
4139

example/package-lock.json

Lines changed: 0 additions & 15680 deletions
This file was deleted.

example/src/components/Lorem.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
p {
2+
font-size: 16px;
3+
line-height: 22px;
4+
color: #8c8c8c;
5+
margin: 0;
6+
}
7+

example/src/components/Lorem.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import './Lorem.css';
2+
3+
export const Lorem: React.FC<{}> = ({ }) => {
4+
return (
5+
<p>
6+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
7+
industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
8+
scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
9+
electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release
10+
of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software
11+
like Aldus PageMaker including versions of Lorem Ipsum.
12+
</p>
13+
)
14+
}

example/src/pages/Home.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* {
2+
--ion-color-primary: #5f468c;
3+
}

example/src/pages/Home.tsx

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,83 @@
1-
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from '@ionic/react';
2-
import ExploreContainer from '../components/ExploreContainer';
1+
import { IonBackButton, IonButton, IonButtons, IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from '@ionic/react';
32
import './Home.css';
43

54
const Home: React.FC = () => {
65
return (
76
<IonPage>
87
<IonHeader>
9-
<IonToolbar>
10-
<IonTitle>Blank</IonTitle>
8+
<IonToolbar mode="ios">
9+
<IonButtons slot='start'>
10+
<IonBackButton defaultHref='/' />
11+
</IonButtons>
12+
<IonTitle>Post Details</IonTitle>
13+
<IonButtons slot='end'>
14+
<IonButton>Button</IonButton>
15+
</IonButtons>
1116
</IonToolbar>
1217
</IonHeader>
13-
<IonContent fullscreen>
14-
<IonHeader collapse="condense">
15-
<IonToolbar>
16-
<IonTitle size="large">Blank</IonTitle>
17-
</IonToolbar>
18-
</IonHeader>
19-
<ExploreContainer />
18+
19+
20+
<IonContent fullscreen className="ion-padding">
21+
<p>This directive enables parallax effect on <code>ion-header</code> elements to display a cover photo while on top of
22+
the page and transition it to the normal navbar when content is scrolled down.</p>
23+
<h2 id="set-up">Set Up</h2>
24+
<ol>
25+
<li>Install package: <code>$ npm i ionic-header-parallax</code>.</li>
26+
<li>Import the directive into your desired module (usually <code>app.module.ts</code>):</li>
27+
</ol>
28+
<pre className="hljs"><code><div><span className="hljs-keyword">import</span> IonicHeaderParallaxModule <span className="hljs-keyword">from</span> <span className="hljs-string">'ionic-header-parallax'</span>;
29+
30+
<span className="hljs-meta">@NgModule</span>(
31+
imports: [
32+
IonicHeaderParallaxModule,
33+
...
34+
</div></code></pre>
35+
<h2 id="usage">Usage</h2>
36+
<p>Just add the attribute <code>parallax</code> to any <code>&lt;ion-header&gt;</code> element:</p>
37+
<pre className="hljs"><code><div><span className="hljs-tag">&lt;<span className="hljs-name">ion-header</span> <span className="hljs-attr">parallax</span>&gt;</span><span className="hljs-tag">&lt;/<span className="hljs-name">ion-header</span>&gt;</span>
38+
</div></code></pre>
39+
<p>Optional attributes:</p>
40+
<ul>
41+
<li><code>imageUrl (string)</code>: The background image to show while expanded.</li>
42+
<li><code>maximumHeight (number)</code>: The height for the header when expanded. Default is <code>200</code>.</li>
43+
<li><code>expandedColor (string)</code>: The color (web hex formatted) to show while the header is expanded when no
44+
<code>imageUrl</code> is set. When scrolled it will fade to the navbar/toolbar's color or the one configured in
45+
<code>&lt;toolbar color=&quot;&quot;&gt;</code> attribute.</li>
46+
<li><code>titleColor (string)</code>: The text color (web hex formatted) for <code>&lt;ion-title&gt;</code> and
47+
<code>&lt;ion-back-button&gt;</code> elements when expanded. They will turn to their default color on cover
48+
collapse.</li>
49+
</ul>
50+
<p>Example:</p>
51+
<pre className="hljs"><code><div><span className="hljs-tag">&lt;<span className="hljs-name">ion-header</span> <span className="hljs-attr">parallax</span> <span className="hljs-attr">imageUrl</span>=<span className="hljs-string">"https://picsum.photos/350"</span> <span className="hljs-attr">maximumHeight</span>=<span className="hljs-string">"350"</span> <span className="hljs-attr">expandedColor</span>=<span className="hljs-string">"#AAA"</span> <span className="hljs-attr">titleColor</span>=<span className="hljs-string">"black"</span>&gt;</span>
52+
53+
<span className="hljs-tag">&lt;<span className="hljs-name">ion-toolbar</span> <span className="hljs-attr">color</span>=<span className="hljs-string">"primary"</span>&gt;</span>
54+
<span className="hljs-tag">&lt;<span className="hljs-name">ion-title</span>&gt;</span>
55+
Parallax Header
56+
<span className="hljs-tag">&lt;/<span className="hljs-name">ion-title</span>&gt;</span>
57+
<span className="hljs-tag">&lt;/<span className="hljs-name">ion-toolbar</span>&gt;</span>
58+
<span className="hljs-tag">&lt;/<span className="hljs-name">ion-header</span>&gt;</span>
59+
60+
<span className="hljs-tag">&lt;<span className="hljs-name">ion-content</span>&gt;</span>
61+
Some content here
62+
<span className="hljs-tag">&lt;/<span className="hljs-name">ion-content</span>&gt;</span>
63+
</div></code></pre>
64+
<h2 id="modifying-the-source-code">Modifying the Source Code</h2>
65+
<p>In case you need to make your own modifications, the package is pretty simple, just 1 .ts file. You can clone the
66+
repo wherever in your ionic project (usually inside the <code>directives</code> folder):
67+
<code>$ git clone https://github.com/RaschidJFR/ionic-header-parallax.git</code>. Then edit the file
68+
<code>src/lib/parallax.directive.ts</code>.</p>
69+
<h2 id="contributing">Contributing</h2>
70+
<p>I don't plan to be full-time maintaining this package, but as I'm usually developing in Ionic I'll be glad to
71+
update it any time I make some upgrades for myself.
72+
Contributions are very welcome. The source files can be found in the <a
73+
href="https://github.com/RaschidGithub/ionic-header-parallax">repo</a>.</p>
74+
<h2 id="credits">Credits</h2>
75+
<p>Raschid JF. Rafaelly</p>
76+
<p><a href="mailto:[email protected]">[email protected]</a></p>
77+
<p><a href="https://raschidjfr.dev">https://raschidjfr.dev</a></p>
78+
<p>This is an implementation of this awesome tutorial on v2 by <a
79+
href="https://www.joshmorony.com/how-to-create-a-directive-in-ionic-2-parallax-header/">Josh Morony</a>. Thanks.
80+
</p>
2081
</IonContent>
2182
</IonPage>
2283
);

0 commit comments

Comments
 (0)