You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
627 B
36 lines
627 B
// @flow
|
|
import type { Styles } from '../types/style'
|
|
|
|
/**
|
|
* CSS to contain a float (credit to CSSMojo).
|
|
*
|
|
* @example
|
|
* // Styles as object usage
|
|
* const styles = {
|
|
* ...clearFix(),
|
|
* }
|
|
*
|
|
* // styled-components usage
|
|
* const div = styled.div`
|
|
* ${clearFix()}
|
|
* `
|
|
*
|
|
* // CSS as JS Output
|
|
*
|
|
* '&::after': {
|
|
* 'clear': 'both',
|
|
* 'content': '""',
|
|
* 'display': 'table'
|
|
* }
|
|
*/
|
|
export default function clearFix(parent?: string = '&'): Styles {
|
|
const pseudoSelector = `${parent}::after`
|
|
return {
|
|
[pseudoSelector]: {
|
|
clear: 'both',
|
|
content: '""',
|
|
display: 'table',
|
|
},
|
|
}
|
|
}
|