diff --git a/ui/utilities/margin/docs.mdx b/ui/utilities/margin/docs.mdx index 60cea401e5..dfe3e4050a 100644 --- a/ui/utilities/margin/docs.mdx +++ b/ui/utilities/margin/docs.mdx @@ -3,19 +3,23 @@ import Example from '../../../shared/components/Example';
Adjust whitespace by applying horizontal and vertical margin helpers
-The base unit of all our spacing metrics is **4**. +The base unit of all of our spacing metrics is **4**. **Before using** + - Most components already come with spacing included. These utility classes are for added convenience in laying out components. -- Classes prefixed by `.slds-m-` are used for adding **margins**. Classes prefixed in `.slds-p-` are used for adding **padding** +- Classes prefixed by `slds-m-` are used for adding **margins**. Classes prefixed in `slds-p-` are used for adding [padding](/components/utilities/padding) - The directions available for the spacing classes are `top`, `right`, `bottom`, and `left`. - You can use the `vertical` shortcut for both `top` and `bottom`, `horizontal` for both `right` and `left`, and `around` for all sides. - Use the `_xxx-small` through `_xx-large` scale to choose the size needed. -- Where **vertical centering** is required, check out our [/components/utilities/media-objects/#center](centered media object) instead of applying extra `margin` or `padding`. +- You can also use `none` as the size on any of the directions to enforce zero margin. +- Where **vertical centering** is required, check out our [centered media object](/components/utilities/media-objects/#center) instead of applying extra `margin` or `padding`. ## Location - Top +
+ @@ -28,8 +32,10 @@ The base unit of all our spacing metrics is **4**. ## Location - Left +
+ @@ -42,8 +48,10 @@ The base unit of all our spacing metrics is **4**. ## Location - Bottom +
+ @@ -56,8 +64,10 @@ The base unit of all our spacing metrics is **4**. ## Location - Right +
+ @@ -70,8 +80,10 @@ The base unit of all our spacing metrics is **4**. ## Location - Horizontal +
+ @@ -84,8 +96,10 @@ The base unit of all our spacing metrics is **4**. ## Location - Vertical +
+ @@ -98,8 +112,10 @@ The base unit of all our spacing metrics is **4**. ## Location - Around +
+ diff --git a/ui/utilities/margin/docs/Margin.jsx b/ui/utilities/margin/docs/Margin.jsx index 55d2094a5c..fe12fd242a 100644 --- a/ui/utilities/margin/docs/Margin.jsx +++ b/ui/utilities/margin/docs/Margin.jsx @@ -2,42 +2,18 @@ // Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license import React, { Component } from 'react'; -import ReactDOM from 'react-dom/server'; -import style from './Margin.scss'; +import './Margin.scss'; import classNames from 'classnames'; import CodeBlock from '../../../../shared/components/CodeBlock'; -const Redline = props => ( - - - -); - class Margin extends Component { render() { - let margin; let { size, position } = this.props; - const sizes = { - 'xxx-small': '0.125rem', - 'xx-small': '0.25rem', - 'x-small': '0.5rem', - small: '0.75rem', - medium: '1rem', - large: '1.5rem', - 'x-large': '2rem', - 'xx-large': '3rem' - }; - let widths = JSON.stringify(sizes); - JSON.parse(widths, (key, value) => { - if (key === size) { - margin = value; - } - }); let spacingClass = `slds-m-${position}_${size}`; return (
-
+