Skip to content
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

docs(getOffsetTop): fix wrong docs and console.log usage #2018

Merged
merged 2 commits into from
Feb 24, 2023
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
3 changes: 2 additions & 1 deletion packages/dnb-design-system-portal/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export const wrapPageElement = pageElement('browser')
// scroll to top on route change
export const shouldUpdateScroll = () => true

export const onRouteUpdate = ({ prevLocation }) => {
export const onRouteUpdate = ({ location, prevLocation }) => {
// Ensure heading levels are reset before each page SSR starts
resetLevels(1)

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export const UploadPrefilledFileList = () => (
{() => {
const Component = () => {
const { files, setFiles } = Upload.useUpload('file-list')
console.log('files', files)

if (files.length) {
console.log('files', files)
}

useMockFiles(setFiles, { errorMessage: 'This is no real file!' })

Expand All @@ -60,7 +63,10 @@ export const UploadSingleFile = () => (
{() => {
const Component = () => {
const { files, setFiles } = Upload.useUpload('upload-single-file')
console.log('files', files, setFiles)

if (files.length) {
console.log('files', files, setFiles)
}

return (
<Upload
Expand Down Expand Up @@ -230,7 +236,10 @@ export const UploadAcceptedFormats = () => (
const { files, setFiles } = Upload.useUpload(
'upload-accepted-formats'
)
console.log('files', files, setFiles)

if (files.length) {
console.log('files', files, setFiles)
}

return (
<Upload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Get the HTML Element offset to the top of the browser window, minus `offset`.
```js
import { getOffsetTop } from '@dnb/eufemia/shared/helpers'

getOffsetTop(offset: Number) // returns Number
getOffsetTop(element: HTMLElement) // returns Number
```

### applyPageFocus
Expand Down
4 changes: 4 additions & 0 deletions packages/dnb-design-system-portal/src/templates/mdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { graphql } from 'gatsby'
import Tabbar from '../shared/tags/Tabbar'
import Layout from '../shared/parts/Layout'
import tags from '../shared/tags'
import { resetLevels } from '@dnb/eufemia/src/components/Heading'

const ContentWrapper = Tabbar.ContentWrapper

Expand All @@ -30,6 +31,9 @@ export default function MdxTemplate(props) {
const categoryFm = category?.frontmatter || {}
const currentFm = mdx?.frontmatter || {}

// Ensure heading levels are reset before each page SSR starts
resetLevels(1)

return (
<Layout
key="layout"
Expand Down