From d63ac36e8ca191717a17616ddadae2caac9e8d88 Mon Sep 17 00:00:00 2001 From: galangel Date: Wed, 15 Jan 2025 23:34:58 +0200 Subject: [PATCH] No tailwind --- README.md | 13 ++++---- package.json | 6 +--- src/components/Scroll/Scroll.stories.tsx | 16 +++++----- src/components/Scroll/ScrollHeader.tsx | 4 +-- src/components/Scroll/ScrollItem.tsx | 6 +--- src/components/Scroll/ScrollList.tsx | 6 +--- src/index.css | 38 ++++++++++++++++++++++-- src/utils/cn.ts | 6 ---- 8 files changed, 53 insertions(+), 42 deletions(-) delete mode 100644 src/utils/cn.ts diff --git a/README.md b/README.md index 2e530f7..5425e44 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ The Scroll Magic Component is a React component that provides smooth scrolling f - sticky headers in both directions - scroll to header by click -- support tailwind - typescript ## Installation @@ -37,14 +36,14 @@ import { ScrollComponent } from 'react-scroll-magic'; const App = () => { return ( - - + +

Scroll down to see the magic!

-
- + +

Keep scrolling...

-
-
+ + ); }; diff --git a/package.json b/package.json index 756402d..d7a20fd 100644 --- a/package.json +++ b/package.json @@ -27,14 +27,10 @@ "prepare": "npm run build", "storybook": "storybook dev -p 6006" }, - "peerDependencies": { + "dependencies": { "react": "^18.0.0", "react-dom": "^18.0.0" }, - "dependencies": { - "clsx": "^2.1.0", - "tailwind-merge": "^2.2.1" - }, "devDependencies": { "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsx-a11y": "^6.10.2", diff --git a/src/components/Scroll/Scroll.stories.tsx b/src/components/Scroll/Scroll.stories.tsx index efcf78f..17c0bdd 100644 --- a/src/components/Scroll/Scroll.stories.tsx +++ b/src/components/Scroll/Scroll.stories.tsx @@ -1,7 +1,5 @@ import { Meta, Story } from '@storybook/react'; -import { Scroll } from './Scroll'; -import { ScrollHeader } from './ScrollHeader'; -import { ScrollItem } from './ScrollItem'; +import { Scroll } from './index'; export default { title: 'Components/Scroll', @@ -11,21 +9,21 @@ export default { const BunchOfItems = ({ numberOfItems }: { numberOfItems: number }) => { const items = Array.from({ length: numberOfItems }, (_, i) => i); return items.map((item) => ( - + Content {item} - + )); }; const Template: Story = (args) => ( - Header 1 + Header 1 - Header 2 + Header 2 - Header 3 + Header 3 - Header 4 + Header 4 ); diff --git a/src/components/Scroll/ScrollHeader.tsx b/src/components/Scroll/ScrollHeader.tsx index a8569d5..5406e44 100644 --- a/src/components/Scroll/ScrollHeader.tsx +++ b/src/components/Scroll/ScrollHeader.tsx @@ -35,9 +35,9 @@ export const ScrollHeader: React.FC = ({ children, style = { return (
  • { return ( -
  • +
  • {children}
  • ); diff --git a/src/components/Scroll/ScrollList.tsx b/src/components/Scroll/ScrollList.tsx index c7d6395..f127be7 100644 --- a/src/components/Scroll/ScrollList.tsx +++ b/src/components/Scroll/ScrollList.tsx @@ -17,11 +17,7 @@ export const ScrollList: React.FC +
      {children}
    ); diff --git a/src/index.css b/src/index.css index b5c61c9..f4e0095 100644 --- a/src/index.css +++ b/src/index.css @@ -1,3 +1,35 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; +.scroll-list { + box-sizing: border-box; + height: 100%; + margin: 0; + padding: 0; + width: 100%; + list-style-position: inside; + overflow-x: hidden; + overflow-y: scroll; + position: relative; +} + +.scroll-header { + position: sticky; + display: flex; + box-sizing: border-box; + border: none; + list-style: none; + padding: 0; + margin: 0; + width: 100%; + z-index: 10; + cursor: pointer; +} + +.scroll-item { + display: flex; + width: 100%; + box-sizing: border-box; + position: relative; + padding: 0; + margin: 0; + border: none; + list-style: none; +} diff --git a/src/utils/cn.ts b/src/utils/cn.ts deleted file mode 100644 index 2819a83..0000000 --- a/src/utils/cn.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { clsx, type ClassValue } from 'clsx'; -import { twMerge } from 'tailwind-merge'; - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); -}