Created
August 24, 2018 18:44
-
-
Save Wolfr/2da454f8ba8dc73178ec2bcfb4ed32d0 to your computer and use it in GitHub Desktop.
Using CSS in Framer X component
This file contains hidden or 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
// Here is a basic Framer X component where we use CSS directly | |
import * as React from "react"; | |
import { PropertyControls, ControlType } from "framer"; | |
// Define type of property | |
interface Props { | |
width: number | |
height: number | |
} | |
const css = ` | |
body { | |
margin: 0; | |
} | |
h4 { | |
font-size: 20px; | |
margin: 0; | |
padding: 0; | |
} | |
p { | |
margin: 0; | |
padding: 0; | |
} | |
.test { | |
background: red; | |
height: 100%; | |
display: flex; | |
}`; | |
export class test extends React.Component<Props> { | |
static defaultProps = { | |
width: 960, | |
height: 70, | |
} | |
render() { | |
return ( | |
<div className="test"> | |
<h4>I am a framer X component</h4> | |
<p>I am a framer X component</p> | |
<style>{css}</style> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment