-
Notifications
You must be signed in to change notification settings - Fork 398
feat: added a method to assign an id to the Section component
#30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,6 @@ | |
| } | ||
| } | ||
|
|
||
| html { | ||
| scroll-behavior: smooth; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,12 +2,14 @@ import React from "react"; | |
|
|
||
| interface ContainerProps { | ||
| children: React.ReactNode; | ||
| idName?: string; | ||
| className?: string; | ||
|
Comment on lines
3
to
6
|
||
| } | ||
|
|
||
| export function Container(props: Readonly<ContainerProps>) { | ||
| return ( | ||
| <div | ||
| id={props.idName || undefined} | ||
| className={`container p-8 mx-auto xl:px-0 ${ | ||
| props.className ? props.className : "" | ||
| }`}> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ import React from "react"; | |||||
| import { Container } from "@/components/Container"; | ||||||
|
|
||||||
| interface SectionTitleProps { | ||||||
| sectionId?: string; | ||||||
| preTitle?: string; | ||||||
|
Comment on lines
4
to
6
|
||||||
| title?: string; | ||||||
| align?: "left" | "center"; | ||||||
|
|
@@ -11,6 +12,7 @@ interface SectionTitleProps { | |||||
| export const SectionTitle = (props: Readonly<SectionTitleProps>) => { | ||||||
| return ( | ||||||
| <Container | ||||||
| idName={`${props.sectionId}`} | ||||||
|
||||||
| idName={`${props.sectionId}`} | |
| idName={props.sectionId} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling
scroll-behavior: smoothglobally can cause motion-sickness and violates user preference for reduced motion. Add a@media (prefers-reduced-motion: reduce)override (e.g., revert toauto) so smooth scrolling is disabled for those users.