Skip to content

Instantly share code, notes, and snippets.

@steveruizok
Created June 27, 2019 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveruizok/b4c4b0b9bdad7b1edf988a954ac36e4b to your computer and use it in GitHub Desktop.
Save steveruizok/b4c4b0b9bdad7b1edf988a954ac36e4b to your computer and use it in GitHub Desktop.
A custom button for the Flow component.
import * as React from "react"
import { Frame, FrameProps, addPropertyControls, ControlType } from "framer"
// @ts-ignore
import { showNext, showPrevious } from "@framer/steveruizok.flow/code"
type Props = Partial<FrameProps> & {
target: string
text: string
}
export function CustomButton(props: Props) {
const { target, text, style, ...rest } = props
const handleTap = () => {
showNext(target)
}
return (
<Frame
{...rest}
background="#0099ff"
color="#FFFFFF"
borderRadius={12}
shadow={"0px 2px 12px rgba(0,0,0,.2)"}
style={{ fontSize: 20, fontWeight: 600, ...style }}
onTap={handleTap}
>
{text}
</Frame>
)
}
CustomButton.defaultProps = {
height: 64,
width: 240,
target: "Home",
text: "Get Started!",
}
addPropertyControls(CustomButton, {
text: {
type: ControlType.String,
defaultValue: "Get Started!",
},
target: {
type: ControlType.String,
defaultValue: "Home",
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment