Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/markdown-renderer/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Paragraph } from 'components/paragraph/Paragraph';
import styled, { DefaultTheme } from 'styled-components';
import breakpoint from 'styled-components-breakpoint';
import { mb, mt, ml, pb } from 'styled-components-spacing';
import { mb, mt, ml, pb, my } from 'styled-components-spacing';
import { Heading } from '../heading/Heading';
import { Link } from '../link/Link';

Expand Down Expand Up @@ -51,8 +51,8 @@ export const OrderedList = styled.ol`

// Fixes for gatsby span wrapper
export const Span = styled.span`
&.gatsby-resp-image-wrapper {
margin: 0 !important;
& > .gatsby-resp-image-wrapper {
${my(5)};
}
`;

Expand Down
6 changes: 5 additions & 1 deletion src/components/table-of-contents/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ const TocItems = ({
onClick={(e) => {
e.preventDefault();
onClickItem?.();
document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' });
if (id === 'introduction') {
window.scrollTo({ top: 0, behavior: 'smooth' });
} else {
document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' });
}
}}
>
{text}
Expand Down
19 changes: 12 additions & 7 deletions src/hooks/useTableOfContents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ const useTableOfContents = () => {

useEffect(() => {
const els = Array.from(
document.querySelectorAll<HTMLElement>('h2[id], h3[id]')
document.querySelectorAll<HTMLElement>('[id="introduction"], h2[id], h3[id]')
);

setHeadings(
els.map((el) => ({
id: el.id,
text: el.textContent ?? '',
level: el.tagName === 'H2' ? 2 : 3,
}))
els.map((el) => {
if (el.id === 'introduction') {
return { id: 'introduction', text: 'Introduction', level: 2 as const };
}
return {
id: el.id,
text: el.textContent ?? '',
level: el.tagName === 'H2' ? 2 : (3 as const),
};
})
);

const INITIAL_TOP = 320; // 20rem
Expand All @@ -31,7 +36,7 @@ const useTableOfContents = () => {
// headings, making the captured `els` reference stale detached nodes
// whose getBoundingClientRect() returns all zeros.
const liveEls = Array.from(
document.querySelectorAll<HTMLElement>('h2[id], h3[id]')
document.querySelectorAll<HTMLElement>('[id="introduction"], h2[id], h3[id]')
);
let currentId = liveEls[0]?.id ?? '';
for (const el of liveEls) {
Expand Down
2 changes: 1 addition & 1 deletion src/posts/nestjs-aws-lambda-cdk-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ By the end of this guide, you’ll have:
- Infrastructure defined as code: a Lambda function, HTTP API Gateway, provisioned with AWS CDK
- A GitHub Actions workflow that builds and deploys your stack automatically on every push to `main`

### ![Simple artchitecture diagram of NestJS deployment in AWS Lambda](../images/nestjs-aws-serverless/nestjs-serverless-lambda-simple-diagram.png)
![Simple artchitecture diagram of NestJS deployment in AWS Lambda](../images/nestjs-aws-serverless/nestjs-serverless-lambda-simple-diagram.png)

The complete source code is available on [GitHub](https://github.com/ajeetchaulagain/nestjs-serverless-aws-lambda-cdk).

Expand Down
2 changes: 1 addition & 1 deletion src/templates/BlogPage/BlogPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const BlogTemplate: React.FC<PageProps<DataProps, PageContextProps>> = (
/>
<HeroBlank />
<ContentRenderer>
<PostHeaderContainer>
<PostHeaderContainer id="introduction">
<PostHeaderLeftColumn>
<Heading size="xlarge">{title}</Heading>

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading