UNPKG

@visual-framework/vf-u-fullbleed

Version:

vf-fullbleed component

145 lines (138 loc) 4.77 kB
/* stylelint-disable */ :root { --vf-color--green: #18974c; --vf-color--green--darkest: #0a5032; --vf-color--green--dark: #007b53; --vf-color--green--light: #6cc24a; --vf-color--green--lightest: #d0debb; --vf-color--grey: #707372; --vf-color--grey--darkest: #373a36; --vf-color--grey--dark: #54585a; --vf-color--grey--light: #a8a99e; --vf-color--grey--lightest: #d0d0ce; --vf-color--red: #d41645; --vf-color--red--dark: #a6093d; --vf-color--red--light: #e58f9e; --vf-color--blue: #3b6fb6; --vf-color--blue--dark: #193f90; --vf-color--blue--light: #8bb8e8; --vf-color--purple: #734595; --vf-color--purple--dark: #563d82; --vf-color--purple--light: #cba3d8; --vf-color--orange: #f49e17; --vf-color--orange--dark: #b65417; --vf-color--orange--light: #efc06e; --vf-color--yellow: #f4c61f; --vf-color--yellow--dark: #ffb81c; --vf-color--yellow--light: #fdd757; --vf-color--bright-green: #a1be1f; --vf-color--bright-green--dark: #7fb428; --vf-color--bright-green--light: #e2e868; } :root { --vf-color__text--primary: #1a1c1a; --vf-color__text--secondary: #373a36; --vf-color__link: #3b6fb6; --vf-color__link--hover: #193f90; --vf-color__link--focus: #193f90; --vf-color__link--visited: #563d82; } :root { --vf-color__button__text--primary: #ffffff; --vf-color__button__border--primary: #3b6fb6; --vf-color__button__background--primary: #3b6fb6; --vf-color__button__shadow--primary: #193f90; --vf-color__button__text--secondary: #3b6fb6; --vf-color__button__border--secondary: #3b6fb6; --vf-color__button__background--secondary: #ffffff; --vf-color__button__shadow--secondary: #193f90; --vf-color__button__text--tertiary: #ffffff; --vf-color__button__border--tertiary: #373a36; --vf-color__button__background--tertiary: #373a36; --vf-color__button__shadow--tertiary: #000000; } :root { --vf-color__brand: #18974c; --vf-color__brand--dark: #0a5032; } :root { --vf-ui-color--black: #000000; --vf-ui-color--grey: #d8d8d8; --vf-ui-color--grey--light: #f3f3f3; --vf-ui-color--yellow: #fffadc; --vf-ui-color--red: #d32f2f; --vf-ui-color--white: #ffffff; --vf-ui-color--off-white: #fafafa; } :root { --vf-color--neutral--0: #ffffff; --vf-color--neutral--100: #f3f3f3; --vf-color--neutral--200: #e4e4e4; --vf-color--neutral--300: #d0d0ce; --vf-color--neutral--400: #a9abaa; --vf-color--neutral--500: #8d8f8e; --vf-color--neutral--600: #707372; --vf-color--neutral--700: #54585a; --vf-color--neutral--800: #373a36; --vf-color--neutral--900: #000000; } :root { --vf-theme--primary: #3b6fb6; --vf-theme--primary--dark: #193f90; --vf-theme--secondary: #18974c; --vf-theme--secondary--dark: #007b53; --vf-theme--tertiary: #54585a; --vf-theme--quaternary: #f4c61f; --vf-theme--quinary: #d0d0ce; } /* stylelint-enable */ /*! * Component: @visual-framework/vf-u-fullbleed * Version: 1.2.3 * Location: components/undefined */ /* * 1. we set the variable for the @at-root directive here. * 2. position: relative is needed for the pseudo element. * 3. make the background colour inherit from classanmes in use. * 4. if we can a full bleed background inline with other content we need to reset * the grid to fill all that space. * 5. make the pseudo element 100% of the element so we can see it. * 6. push the pseudo element away from the left of the viewport but allows for potential * 'context customisation'. * 7. If the component has vertical padding we need to make sure the pseudo element * is set to the top of the containing box. * 8. make the pseudo element full-width but allows for potential 'context customisation'. * 9. put the pseudo element 'underneath' the element so it doesn't block. * 10. Because Windows always shows scrollbars this technique creats a horizontal * scroll bar, we need to apply position: relative; to a parent element. Encapsulating this CSS rule inside the component means it would only be set if the site includes this component and it's CSS. */ .vf-u-fullbleed { /* 1 */ background-position: center center; background-repeat: no-repeat; background-size: 0 0; position: relative; /* 2 */ } .vf-u-fullbleed::before { background-color: inherit; /* 3 */ background-image: inherit; background-position: inherit; background-repeat: inherit; background-size: cover; content: ""; grid-column: 1/-1; /* 4 */ height: 100%; /* 5 */ margin-left: calc(50% - 50vw); margin-left: calc(50% - (50vw - var(--context-margin--inline, 0px))); /* 6 */ position: absolute; top: 0; /* 7 */ width: 100vw; width: calc(100vw - var(--context-margin--inline, 0px) * 2); /* 8 */ z-index: -1; /* 9 */ } body { position: relative; /* 10 */ }