Skip to content

Commit bf352ed

Browse files
committed
add more info about deprecated NotificationStyles attributes in docs
1 parent 30cae04 commit bf352ed

4 files changed

Lines changed: 32 additions & 12 deletions

File tree

docs/website/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function App() {
2424
<>
2525
<Toaster position="top-right" />
2626
<Header version={version} setVersion={setVersion} />
27-
<main className="flex fd-colum">
27+
<main className="flex">
2828
<SiteOverview version={version} />
2929
<main className="flex fd-column width100per">
3030
<Routes>

docs/website/src/assets/css/quick-styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ span.code {
148148
border-radius: 3px;
149149
white-space: normal;
150150
word-break: break-word;
151+
line-height: 1.8;
151152
}
152153

153154
span.code.green {

docs/website/src/pages/ReferencePage.tsx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { nanoid } from 'nanoid';
44
import { useEffect, useState } from 'react';
55
import { Link } from 'react-router'
66
import { Iversion } from '../assets/js/mytypes';
7+
import { isLegacyVersion } from '../assets/js/helper';
78

89
type arg = { name: string; desc: string }
910
type object_list = {
@@ -17,7 +18,7 @@ interface IReferencePage {
1718
HANDLER_METHODS: object_list[];
1819
STYLE_ATTRIBUTES: object_list[];
1920
}
20-
export default function ReferencePage({ version }: { version:Iversion}) {
21+
export default function ReferencePage({ version }: { version: Iversion }) {
2122
const [data, setData] = useState<IReferencePage>()
2223

2324
async function changeVersionData(version: Iversion) {
@@ -59,10 +60,10 @@ export default function ReferencePage({ version }: { version:Iversion}) {
5960
<h2>For v1.59</h2>
6061
<p className='paragraph'>Add methods working to free up __init__ kwargs [parsing out `style` attribute] </p>
6162
<div className='paragraph'>
62-
<span className="cod paragraph">setSmallIcon</span> == <span className="code yellow-shade">Notification(..., app_icon="...") </span><br/><br/>
63-
<span>setLargeIcon</span> == <span className="code yellow-shade">Notification(..., large_icon_path="...", style=NotificationStyles.LARGE_ICON)</span><br/><br/>
64-
<span>setBigPicture</span> == <span className="code yellow-shade">Notification(..., big_picture_path="...",style=NotificationStyles.BIG_PICTURE)</span><br/><br/>
65-
<span>setBigText</span> == <span className="code yellow-shade">Notification(..., body="...", style=NotificationStyles.BIG_TEXT)</span><br/>
63+
<span className="cod paragraph">setSmallIcon</span> == <span className="code yellow-shade">Notification(..., app_icon="...") </span><br /><br />
64+
<span>setLargeIcon</span> == <span className="code yellow-shade">Notification(..., large_icon_path="...", style=NotificationStyles.LARGE_ICON)</span><br /><br />
65+
<span>setBigPicture</span> == <span className="code yellow-shade">Notification(..., big_picture_path="...",style=NotificationStyles.BIG_PICTURE)</span><br /><br />
66+
<span>setBigText</span> == <span className="code yellow-shade">Notification(..., body="...", style=NotificationStyles.BIG_TEXT)</span><br />
6667
</div>
6768
</section>}
6869
{/* Instance Methods Section */}
@@ -106,7 +107,25 @@ export default function ReferencePage({ version }: { version:Iversion}) {
106107
</section>
107108

108109
<section id="notificationstyles-class" className="space-y-6 page-section" tabIndex={0}>
109-
<h2 className="text-xl font-bold">NotificationStyles attributes for Safely Adding Styles</h2>
110+
{isLegacyVersion(version) ?
111+
<h2 className="text-xl font-bold">NotificationStyles attributes for Safely Adding Styles</h2>
112+
:
113+
<>
114+
<h2 className="text-xl font-bold">NotificationStyles</h2>
115+
<p className="paragraph">
116+
Most of NotificationStyles attributes are deprecated in v1.59 except <span className='code green'>NotificationStyles.INBOX</span>, but they're still available for backward compatibility.
117+
You can use the <span className="code yellow-shade">style</span> attribute in the Notification class to set styles.</p>
118+
<p>For example:</p>
119+
<p>Notification.setLargeIcon('profile.png') replaced</p>
120+
<p className="paragraph inner-section-2">
121+
<span className="code yellow-shade">Notification(..., large_icon_path="profile.png", style=NotificationStyles.LARGE_ICON)</span>
122+
</p>
123+
<p className="paragraph">
124+
You can also use the <span className="code yellow-shade">setLargeIcon</span>, <span className="code yellow-shade">setBigPicture</span>, and <span className="code yellow-shade">setBigText</span>
125+
methods to set the respective styles of <span className="code">NotificationStyles.LARGE_ICON</span>, <span className="code">NotificationStyles.BIG_PICTURE</span>, <span className="code">NotificationStyles.BIG_TEXT</span>
126+
</p>
127+
</>
128+
}
110129
<div className='flex flex-wrap align-items-cen justify-content-cen styles-container'>
111130

112131
{data?.STYLE_ATTRIBUTES.map((m) => (

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,11 @@ const HANDLER_METHODS = [
402402
];
403403

404404
const STYLE_ATTRIBUTES = [
405-
{
406-
id: 'simple',
407-
signature: 'NotificationStyles.DEFAULT',
408-
description: 'contains default style "simple"'
409-
},
405+
// {
406+
// id: 'simple',
407+
// signature: 'NotificationStyles.DEFAULT',
408+
// description: 'contains default style "simple"'
409+
// },
410410
{
411411
id: 'LARGE_ICON',
412412
signature: 'NotificationStyles.LARGE_ICON',

0 commit comments

Comments
 (0)