@react-to-styled/loader
Advanced tools
| import { FunctionComponent } from 'react'; | ||
| /** | ||
| * Loader props. | ||
| */ | ||
| interface LoaderProps { | ||
| /** | ||
| * Sets loader in the center of the page. | ||
| */ | ||
| isFullScreen?: boolean; | ||
| /** | ||
| * Instead of `isFullScreen` this can set minHeight of the wrapper and loder will be in the center. | ||
| */ | ||
| wrapperHeight?: number | string; | ||
| /** | ||
| * Sets the loader radius. | ||
| */ | ||
| loaderSize?: number; | ||
| } | ||
| export declare const Loader: FunctionComponent<LoaderProps>; | ||
| export {}; |
| import { Colors } from '@react-to-styled/essentials'; | ||
| import React from 'react'; | ||
| import styled, { keyframes } from 'styled-components'; | ||
| export const Loader = ({ isFullScreen, wrapperHeight = 300, loaderSize = 72, }) => { | ||
| if (isFullScreen) { | ||
| return (React.createElement(Wrapper, { wrapperHeight: wrapperHeight }, | ||
| React.createElement(Element, { "data-element": "loader", loaderSize: loaderSize }))); | ||
| } | ||
| return React.createElement(Element, { "data-element": "loader", loaderSize: loaderSize }); | ||
| }; | ||
| const loaderKeyframe = keyframes ` | ||
| 0% { | ||
| transform: rotate(0); | ||
| } | ||
| 100% { | ||
| transform: rotate(360deg); | ||
| } | ||
| `; | ||
| const Wrapper = styled.div ` | ||
| width: 100%; | ||
| ${({ wrapperHeight }) => `height: ${typeof wrapperHeight === 'number' ? `${wrapperHeight}px` : wrapperHeight}`}; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| `; | ||
| const Element = styled.div ` | ||
| width: 72px; | ||
| height: 72px; | ||
| border-radius: 50%; | ||
| font-size: 10px; | ||
| position: relative; | ||
| border: 4px solid transparent; | ||
| border-left-color: ${Colors.darkBlue}; | ||
| transform: translateZ(0); | ||
| animation: ${loaderKeyframe} 1.1s infinite linear; | ||
| ${({ loaderSize }) => ` | ||
| width: ${loaderSize}px; | ||
| height: ${loaderSize}px; | ||
| ::after { | ||
| width: ${loaderSize}px; | ||
| height: ${loaderSize}px; | ||
| border-radius: 50%; | ||
| } | ||
| `}; | ||
| `; |
+21
| MIT License | ||
| Copyright (c) 2022 react-to <aleksa.toljic@gmail.com> | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
+8
-0
@@ -6,2 +6,10 @@ # Change Log | ||
| ## [0.1.4](https://github.com/react-to/react-to-styled/compare/@react-to-styled/loader@0.1.3...@react-to-styled/loader@0.1.4) (2022-02-04) | ||
| **Note:** Version bump only for package @react-to-styled/loader | ||
| ## [0.1.3](https://github.com/react-to/react-to-styled/compare/@react-to-styled/loader@0.1.2...@react-to-styled/loader@0.1.3) (2022-02-04) | ||
@@ -8,0 +16,0 @@ |
+4
-2
| { | ||
| "name": "@react-to-styled/loader", | ||
| "version": "0.1.3", | ||
| "version": "0.1.4", | ||
| "description": "Loader", | ||
@@ -29,2 +29,4 @@ "keywords": [ | ||
| "CHANGELOG.md", | ||
| "README.md", | ||
| "../../LICENSE", | ||
| "dist/" | ||
@@ -38,3 +40,3 @@ ], | ||
| }, | ||
| "gitHead": "38b565daab0d7d2d4d6d7b08c48c1aeae7dc5b05" | ||
| "gitHead": "88e67cc8eb39dd35e9da1abfe8e4071c06a83687" | ||
| } |
| { | ||
| "name": "@react-to-styled/loader", | ||
| "version": "0.1.2", | ||
| "description": "Loader", | ||
| "keywords": [ | ||
| "react", | ||
| "styled-components", | ||
| "library", | ||
| "components", | ||
| "frontend", | ||
| "reuseable", | ||
| "ui", | ||
| "loader" | ||
| ], | ||
| "main": "dist/index.js", | ||
| "homepage": "https://react-to.github.io/react-to-styled/?path=/story/table--page", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/react-to/react-to-styled.git" | ||
| }, | ||
| "scripts": { | ||
| "typecheck": "tsc --declaration --resolveJsonModule", | ||
| "prepublish": "yarn typecheck" | ||
| }, | ||
| "files": [ | ||
| "dist/" | ||
| ], | ||
| "license": "MIT", | ||
| "peerDependencies": { | ||
| "@react-to-styled/essentials": "^0.0.1", | ||
| "react": "^16.8.0 || ^17.0.0", | ||
| "react-dom": "^16.8.0 || ^17.0.0", | ||
| "styled-components": "^5.1.1", | ||
| "typescript": "^4" | ||
| }, | ||
| "dependencies": { | ||
| "@react-to-styled/essentials": "^0.1.2", | ||
| "react": "^17.0.2", | ||
| "styled-components": "^5.1.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/styled-components": "^5.1.21", | ||
| "typescript": "^4" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "gitHead": "922a052afec8eed37203511df19ddfa008f7eb12" | ||
| } |
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
6482
41.13%6
50%65
Infinity%0
-100%