1.1.2 • Published 6 months ago

react-magic-motion v1.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

⭐️ Getting Started

📦 Install

npm i react-magic-motion

🔎 Simple Example

🎥 Demo

https://github.com/Etesam913/react-magic-motion/assets/55665282/dfc56ad5-5012-4f5e-90cc-8ec372527320

🧑‍💻 Code

import { useState } from "react";
import { MagicMotion } from "react-magic-motion";

function ListItem({ children }: { children: string }) {
  return (
    <li
      style={{
        backgroundColor: "#4d4d4dff",
        width: "20rem",
        padding: "0.5rem",
      }}
    >
      {children}
    </li>
  );
}

export default function App() {
  const [areGoalsShowing, setAreGoalsShowing] = useState(true);
  return (
    <MagicMotion>
      <div
        style={{
          margin: "0.75rem auto 0",
          width: "20rem",
          display: "flex",
          flexDirection: "column",
          gap: "1rem",
          overflow: "hidden",
        }}
      >
        <h1
          style={{
            fontWeight: "bold",
            margin: "0.25rem",
          }}
        >
          My Goals
        </h1>
        {areGoalsShowing && (
          <ul
            style={{
              display: "flex",
              flexDirection: "column",
              gap: "0.75rem",
              listStyle: "none",
              paddingLeft: "0.5rem",
              margin: 0,
            }}
          >
            <ListItem>🏀 Make 10 three pointers in a row</ListItem>
            <ListItem>🏋️‍♂️ Bench press 225 lbs</ListItem>
            <ListItem>🏃‍♂️ Run a 5k in under 20 minutes</ListItem>
          </ul>
        )}
        <button
          style={{
            width: "fit-content",
            whiteSpace: "nowrap",
            padding: "0.5rem 1rem",
            backgroundColor: "#5a70ed",
            color: "#ffffff",
            border: 0,
            cursor: "pointer",
            fontFamily: "inherit",
          }}
          onClick={() => setAreGoalsShowing(!areGoalsShowing)}
        >
          {areGoalsShowing ? "Hide" : "Show"} my goals
        </button>
      </div>
    </MagicMotion>
  );
}

💫 Examples

📓 Docs

  • For a full understanding of react-magic-motion visit the docs here

❓ Want to Contribute

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.9

6 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago