Skip to content

Commit 3a4f8a0

Browse files
committed
displaying custom notification in docs
1 parent 17c3d98 commit 3a4f8a0

5 files changed

Lines changed: 16 additions & 11 deletions

File tree

27.4 KB
Loading

docs/website/src/assets/js/helper.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,6 @@ export {
161161
formatDate,
162162
range
163163
};
164+
export function isLegacyVersion(version: number) {
165+
return version <= 1.58;
166+
}

docs/website/src/pages/AdvancedMethodsPage.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import '../assets/css/advmethodspage.css'
77
import channelimg from '../assets/imgs/channelname.jpg'
88
import { useEffect, useState } from 'react';
99
import { Iversion } from '../assets/js/mytypes';
10+
import { isLegacyVersion } from '../assets/js/helper';
1011

1112
interface IAdvancedMethodsPage {
1213
title_and_message_update_code: string;
@@ -16,10 +17,6 @@ interface IAdvancedMethodsPage {
1617
getting_identifier_code: string;
1718
}
1819

19-
function isLegacyVersion(version: number) {
20-
return version <= 1.58;
21-
}
22-
2320
export default function AdvancedMethodsPage({ version }: { version: Iversion }) {
2421
const [data, setData] = useState<IAdvancedMethodsPage>()
2522

docs/website/src/pages/ComponentsPage.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ import btnsImg from './../assets/imgs/btns.jpg'
1414
import progressbarImg from './../assets/imgs/progress.jpg'
1515
import largeIconImg from './../assets/imgs/largeicon.jpg'
1616
import inboxImg from '../assets/imgs/inboxnoti.jpg'
17+
import customIconImg from "../assets/imgs/custom_icon.jpg"
1718
// import { appiconcode, bigimgcode, bigtextcode, buttons_code, inboxcode, largeiconcode, progressbarcode } from './versions-data/componentspage';
1819

1920
import { CodeBlock } from '../ui/CodeBlock/CodeBlock';
2021
import { useEffect, useState } from 'react';
2122
import { Iversion } from '../assets/js/mytypes';
23+
import { isLegacyVersion } from '../assets/js/helper';
2224

2325

2426
interface IComponentPage {
@@ -91,9 +93,12 @@ export default function ComponentsPage({ version }: { version: Iversion }) {
9193
{/* {data?.how_to_add_both_imgs} */}
9294
{/* <p className="paragraph">For Both Images pass in <span className="code">NotificationStyles.BOTH_IMGS</span> as argument to <span className="code">style</span> and provide both paths</p> */}
9395
<h3 className='app-icon-h3 sub-header'>Changing Default Notification Icon</h3>
94-
<p className='paragraph'>When you initialize Notification instance you can pass in file path to <span className="code">app_icon</span> </p>
95-
<p className='paragraph'>Must use <span className="code yellow"> PNG format</span> Or Image Will display as a Black Box</p>
96-
<CodeBlock title='Custom Icon' img='' code={data?.small_icon_code || ''} />
96+
{isLegacyVersion(version)?
97+
<p className='paragraph'>When you initialize Notification instance you can pass in file path to <span className="code">app_icon</span> </p>
98+
:<p className='paragraph'>Use <span className="code">.setSmallIcon(path)</span> to set custom notification icon</p>
99+
}
100+
<p className='paragraph'>Must use <span className="code yellow"> PNG format</span> Or Image Will display as a Black Box.</p>
101+
<CodeBlock title='Custom Icon' img={customIconImg} code={data?.small_icon_code || ''} />
97102
<p className='paragraph inner-section-1'>For about Images see <Link to='/advanced-methods#updating-notification'>advanced methods</Link> section</p>
98103
</div>
99104
</section>

docs/website/src/pages/versions-data/1.59.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ notification.addButton(text="Turn Off",on_release=turnOffNoti)
7272
notification.addButton(text="Watch Later",on_release=watchLater)
7373
notification.send()`
7474
const appiconcode = `notification = Notification(
75-
title="Custom Icon",
76-
message="Also persist notification test"
75+
title="custom icon notification",
76+
message="using .setSmallIcon to set notification icon"
7777
)
78-
notification.setSmallIcon("assets/icons/download.png")
79-
notification.send(persistent=True)`
78+
notification.setSmallIcon("icons/butterfly.png")
79+
notification.send(persistent=True) # how to persistent notification`
8080

8181

8282

0 commit comments

Comments
 (0)