Skip to content

Instantly share code, notes, and snippets.

View mandymichael's full-sized avatar

Mandy Michael mandymichael

View GitHub Profile
@mandymichael
mandymichael / collection-gist-1.js
Last active January 6, 2020 02:06
Collection Adding Borders
export const Collection = styled('div')(({ theme }) => ({
display: 'grid',
gridGap: 12,
gridTemplateColumns: '1fr',
paddingBottom: 8,
borderBottom: '4px double grey',
'& > div:not(:first-child)': {
position: 'relative',
@mandymichael
mandymichael / ambient-light-simple-demo.js
Created December 16, 2019 12:21
Simple Ambient Light Sensor Demo
if ( 'AmbientLightSensor' in window ) {
const sensor = new AmbientLightSensor();
sensor.onreading = () => {
if ( sensor.illuminance < 20) {
element.style.setProperty('--bg', 'black’);
} else {
element.style.setProperty('--bg', 'blue’);
}
};
sensor.start();
componentDidMount() {
this.detectInViewport()
addListener('scroll', this.detectInViewport)
addListener('resize', this.detectInViewport)
}
detectInViewport = () => {
const { top, bottom, height } = this.innerRef.getBoundingClientRect()
// Calculate if on screen and distance from the viewport...
this.setState({ inViewport: viewportPosition, viewportHeight, distanceFromViewport })
## Inspiration
### SWISS Design
1. https://www.designspiration.net/save/534385462519/
2. Google Swiss Design
## Useful Links
@mandymichael
mandymichael / index.html
Last active March 21, 2018 12:44
Text Effect: Variable Fonts Template - DECOVAR
<h1 data-text="Hello">Hello</h1>