diff --git a/examples/simple/index.html b/examples/simple/index.html index 57bf0c8..fa3dfed 100755 --- a/examples/simple/index.html +++ b/examples/simple/index.html @@ -24,7 +24,6 @@ width: 20vw; height: 20vw; overflow: hidden; - resize: both; padding: 5px; text-align: center; border: 1px solid #ccc; @@ -35,6 +34,10 @@ white-space: nowrap; } + .description { + width: 100%; + } + .centered { position: absolute; top: 50%; @@ -42,6 +45,51 @@ transform: translate(-50%, -50%); } + .circle { + position: relative; + width: 2em; + height: 0; + padding: 1em 0; + margin: 1em auto; + border-radius: 50%; + background: #a7cd80; + color: #ffffff; + } + + .xcontent { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + text-align: center; + } + + .xcontent:before { + content: ''; + vertical-align: middle; + display: inline-block; + width: 0; + height: 100%; + } + + .xcontent span { + vertical-align: middle; + display: inline-block; + line-height: 1; + font-size: 1em; + } + + .line { padding: 0.5em; } + .line--1 { padding-left: 1em; } + .line--2 { padding-left: 2em; } + .line--3 { padding-left: 3em; } + .line--4 { padding-left: 4em; } + code { + color: #666; + font-size: .8em; + } + diff --git a/examples/simple/index.js b/examples/simple/index.js index 072bb8f..f96ab02 100755 --- a/examples/simple/index.js +++ b/examples/simple/index.js @@ -2,56 +2,84 @@ import React from 'react'; import ReactDom from 'react-dom'; import ScaleText from '../../src/index'; +const Circle = ({ text }) => ( +
+
+ {text} +
+
+); + +const Box = ({ text = "", centered = false, ...props }) => ( +
+ + + {text} + + +
+); + const App = () => (
-
- +

Examples

+

To see the component in action, resize the browser window.

+

The markup rendering each box below is the following:
+

+      <div class="box">
+ <ScaleText>
+ <span class="box-text">
+ Box 1
+ </span>
+ </ScaleText>
+ </div>
+
+

+
+ + <ScaleText /> +
-
- - - Box 1 - - -
-
- - - Box 2 - - -
-
- - - Box 3 - - -
-
- - - Box 4 - - -
-
- - - Box 5 - - -
+ +
+ +
+ + <ScaleText minFontSize={20} /> +
+
+
+ +
+ +
+ + <ScaleText maxFontSize={55} /> +
+
+ +
+ +
+ + <ScaleText minFontSize={20} maxFontSize={55} /> +
+
+
+ +
+ +
+ + <ScaleText /> +
+
+
+ +
+
); diff --git a/webpack.config.js b/webpack.config.js index a001d6d..0156efd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -40,9 +40,8 @@ module.exports = { output: { path: __dirname + '/lib', filename: fileName, - library: exportName, - libraryTarget: 'umd', - umdNamedDefine: true + library: exportName, + libraryTarget: 'umd' }, plugins: plugins, resolve: {