Skip to content

Commit 788df12

Browse files
committed
nicer animation
1 parent 4ec85cb commit 788df12

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/components/css/main/index.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
backdrop-filter: blur(16px);
3939
box-sizing: border-box;
4040
margin-top: 32px;
41-
margin-bottom: 16px;
41+
margin-bottom: 32px;
4242
padding: 32px 48px;
43-
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, .7);
43+
box-shadow: 0px 0px 32px 0px rgba(0, 0, 0, .7);
4444
}
4545

4646
.separator {

src/components/css/main/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const Main: React.FC = () => {
3838

3939
const [selectedPage, selectPage] = useState<PageInfo | null>(initial_page || null)
4040
const [showExtra, setShowExtra] = useState(false);
41+
const lastSelectedPage = useRef(selectedPage);
4142

4243
const contentRef = useRef<HTMLDivElement>(null)
4344
const [initialRenderComplete, setInitialRenderComplete] = React.useState(false);
@@ -52,6 +53,10 @@ export const Main: React.FC = () => {
5253

5354
//copy state to history on page change
5455
useEffect(() => {
56+
if (selectedPage != null) {
57+
lastSelectedPage.current = selectedPage;
58+
}
59+
5560
window.history.pushState({}, "", selectedPage?.url ?? "/");
5661
}, [selectedPage]);
5762

@@ -129,7 +134,7 @@ export const Main: React.FC = () => {
129134

130135
{!initialRenderComplete ? null : <Expandable expanded={showContent}>
131136
<div ref={contentRef} className={styles.content}>
132-
<div className="not-print">{selectedPage?.page}</div>
137+
<div className="not-print">{selectedPage?.page ?? lastSelectedPage?.current?.page}</div>
133138
<div className="print-only">{selectedPage?.page}</div>
134139
</div>
135140
</Expandable>}

0 commit comments

Comments
 (0)