Created
August 23, 2018 19:59
-
-
Save robertvanhoesel/28a20b00df3c02e813970c49bc0c8c26 to your computer and use it in GitHub Desktop.
Make any keyboard design in Framer interactive, using the text on the button as input onTap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Override, Data } from "framer"; | |
const app = Data({ Text: "" }); | |
export const Input: Override = props => { | |
return { | |
text: app.Text.length > 0 ? app.Text : "Type something...", | |
opacity: app.Text.length > 0 ? 1 : 0.6 | |
}; | |
}; | |
export const Button: Override = props => { | |
return { | |
onTap: e => { | |
app.Text += e.target.innerText || ""; | |
} | |
}; | |
}; | |
export const ClearInput: Override = props => ({ | |
onTap: () => (app.Text = "") | |
}); | |
export const SpaceBar: Override = props => ({ | |
onTap: () => (app.Text += " ") | |
}); | |
export const Delete: Override = props => ({ | |
onTap: () => (app.Text = app.Text.substr(0, app.Text.length - 1)) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment