Search

Back

Copy Link

Library

/

Free

/

6

Skew & Toggle Fill

6

Skew & Toggle Fill

Not loading? Preview

Made by

@frameroverrides

override

hover

Override

Skew & Toggle Fill

Copy

Override

Copied to Clipboard!

Instructions

Code Preview

import type { ComponentType } from "react"
import { useState } from "react"

export const withSkewAndBackgroundColor = (
    Component: ComponentType
): ComponentType => {
    return (props) => {
        const [bgColor, setBgColor] = useState(
            props.style?.backgroundColor || "#FFF"
        )

        const randomColor = () => {
            const letters = "0123456789ABCDEF"
            let color = "#"
            for (let i = 0; i < 6; i++) {
                color += letters[Math.floor(Math.random() * 16)]
            }
            return color
        }

        return (
            <Component
                {...props}
                whileHover={{ skew: -10, backgroundColor: bgColor }}
                onMouseEnter={() => setBgColor(randomColor())}
            />
        )
    }
}

Terms of Use for Free Assets

By accessing and using this Framer Override Library, you agree to the following terms:

All code snippets provided are available for your personal and professional use. This includes personal websites, client projects, and other website projects in Framer. You are strictly prohibited from sharing, redistributing, selling these code snippets, or creating derivative works for resale or distribution. Unauthorized sharing, distribution, or selling of these code snippets is a breach of these terms and may result in termination of your access to this library, along with potential legal action.