Skip to content

Commit

Permalink
Merge pull request #32 from nordnet/feat/add-offsets
Browse files Browse the repository at this point in the history
feat: add offsets and align to new grid
  • Loading branch information
mjmonline authored Jun 18, 2019
2 parents 9d0fd87 + c345854 commit ae86513
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/grid/styles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { media, breakpoints, containers } from '../spec';
import { media, breakpoints, containers, offsets } from '../spec';

const styles = {
grid: {
Expand All @@ -17,6 +17,7 @@ const styles = {
Object.keys(breakpoints).forEach(breakpoint => {
styles.grid[media(breakpoint)] = {
width: breakpoint === 'xs' ? '100%' : containers[breakpoint],
padding: [0, offsets[breakpoint]],
};
});

Expand Down
17 changes: 13 additions & 4 deletions src/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ export const columns = 12;

export const gutter = 20;

export const offsets = {
// Used for Grid's outer padding
xs: 12,
sm: 24,
md: 28,
lg: 96,
xl: 10,
};

export const containers = {
xs: false,
sm: breakpoints.sm - 2 * 24,
md: breakpoints.md - 2 * 28,
lg: breakpoints.lg - 2 * 94,
xl: breakpoints.xl - 2 * 40,
sm: breakpoints.sm,
md: breakpoints.md,
lg: breakpoints.lg,
xl: breakpoints.xl,
};

export default {
Expand Down

0 comments on commit ae86513

Please sign in to comment.