diff --git a/src/components/Spinner/README.md b/src/components/Spinner/README.md index bcb3332..fb45949 100644 --- a/src/components/Spinner/README.md +++ b/src/components/Spinner/README.md @@ -8,5 +8,8 @@ Custom size and stroke:
+ + +
``` diff --git a/src/components/Spinner/__snapshots__/index.spec.js.snap b/src/components/Spinner/__snapshots__/index.spec.js.snap index e8f4f31..4d1592d 100644 --- a/src/components/Spinner/__snapshots__/index.spec.js.snap +++ b/src/components/Spinner/__snapshots__/index.spec.js.snap @@ -1,8 +1,72 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Spinner renders correctly with additional classname 1`] = ` +
+ + + + + +
+`; + +exports[`Spinner renders correctly with custom block 1`] = ` +
+ + + + + +
+`; + exports[`Spinner renders correctly with custom colors (named color) 1`] = `
+ + + + + +
+`; + +exports[`Spinner renders correctly with custom inline 1`] = ` +
{ const style = { width: size, @@ -21,9 +23,22 @@ const Spinner = ({ const r = (size - stroke) / 2; const translate = r + (stroke / 2); const dash = 2 * Math.PI * r; + const classes = ['fandom-spinner']; + + if (block) { + classes.push('is-block'); + } + + if (inline) { + classes.push('is-inline'); + } + + if (className) { + classes.push(className); + } return ( -
+
{ ); expect(component.toJSON()).toMatchSnapshot(); }); + +test('Spinner renders correctly with custom inline ', () => { + const component = renderer.create( + + ); + expect(component.toJSON()).toMatchSnapshot(); +}); + +test('Spinner renders correctly with custom block ', () => { + const component = renderer.create( + + ); + expect(component.toJSON()).toMatchSnapshot(); +}); + +test('Spinner renders correctly with additional classname', () => { + const component = renderer.create( + + ); + expect(component.toJSON()).toMatchSnapshot(); +}); diff --git a/src/components/Spinner/styles.scss b/src/components/Spinner/styles.scss index 3cfe3cf..b8eb373 100644 --- a/src/components/Spinner/styles.scss +++ b/src/components/Spinner/styles.scss @@ -30,4 +30,21 @@ stroke: $wds-color-link; } } + + &.is-block { + display: block; + left: auto; + margin: auto; + position: relative; + } + + &.is-inline { + height: 1em; + left: 0; + margin: 0; + position: static; + top: 0; + width: auto; + } + }