Skip to content

Commit

Permalink
change way of getting scroll preview element
Browse files Browse the repository at this point in the history
  • Loading branch information
Bridgetamana committed Aug 20, 2024
1 parent a096916 commit 62464a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/lib/getElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,6 @@ export const getGridFields = (

export const getGridPreview = (attribute: string): HTMLElement =>
document.getElementById(`${attribute}-preview`) as HTMLElement;

export const getScrollPreview = (): HTMLElement =>
document.getElementById('scroll-preview') as HTMLElement;
5 changes: 2 additions & 3 deletions src/pages/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getCopyCodeButton,
getCssOrTailwindButton,
getCssOrTailwindDropdown,
getScrollPreview,
} from '../lib/getElements';
import {closeDropdown, showPopup} from '../lib/packages/utils';

Expand Down Expand Up @@ -83,9 +84,7 @@ function copyHandler(values: Values) {
}

export function scrollGenerator() {
const previewElement = document.getElementById(
'scroll-preview'
) as HTMLElement;
const previewElement = getScrollPreview();

function applyPreviewStyles(values: Values) {
if (!previewElement) return;
Expand Down

0 comments on commit 62464a6

Please sign in to comment.