Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
styled-velocity
Advanced tools
Styled-Velocity, a React-based styled prop and UI library to increase your velocity and help build your Design System.
Styled-Velocity, a React-based styled prop and UI library to increase your velocity and help build your Design System.
yarn add styled-velocity
or
npm install styled-velocity
Import example:
import { appearanceProps, cssProps, dimensionProps } from 'styled-velocity'
All of the following have access to the sharedProps.
Import example:
import { Element } 'styled-velocity'
import | prop | css property | conversionType |
---|---|---|---|
appearanceProps | bg | background | |
"" | bgImage | background-image | |
"" | bgSize | background-size | |
"" | borderRadius | border-radius | |
"" | boxShadow | box-shadow | |
cssProps | css | any css | |
dimensionProps | m | margin | percentageOrPixel |
"" | mt | margin-top | "" |
"" | mb | margin-bottom | "" |
"" | ml | margin-left | "" |
"" | mr | margin-right | "" |
"" | mx | ml and mr | "" |
"" | my | mt and mb | "" |
"" | p | padding | "" |
"" | pt | padding-top | "" |
"" | pb | padding-bottom | "" |
"" | pl | padding-left | "" |
"" | pr | padding-right | "" |
"" | px | pl and pr | "" |
"" | py | pt and pb | "" |
"" | h | height | "" |
"" | w | width, flex-basis | "" |
"" | minh | min-height | "" |
"" | minw | min-width | "" |
"" | maxh | max-height | "" |
"" | maxw | max-width | "" |
"" | c | cw and ch | getCells |
"" | cw | cells wide | "" |
"" | ch | cells height (cells tall) | "" |
"" | cm | cells margin | "" |
"" | cml | cells margin-left | "" |
"" | cmr | cells margin-right | "" |
"" | cmt | cells margin-top | "" |
"" | cmb | cells margin-bottom | "" |
"" | cmx | cml and cmr | "" |
"" | cmy | cmt and cmb | "" |
"" | cp | cells padding | "" |
"" | cpl | cells padding-left | "" |
"" | cpr | cells padding-right | "" |
"" | cpt | cells padding-top | "" |
"" | cpb | cells padding-bottom | "" |
"" | cpx | cpl and cpr | "" |
"" | cpy | cpt and cpb | "" |
"" | ctransform | cells transform | getCellsTranslate |
displayMode | displayMode | outputs bounding box color | |
flexProps | direction | flex-direction | getFlexProperty |
"" | wrap | flex-wrap | "" |
"" | align | justify-content | "" |
"" | valign | align-items | "" |
"" | valignContent | align-content | "" |
gridLines | gridLines | outputs grid lines | |
growShrinkProps | grow | flex-grow | booleanToIntString |
"" | shrink | flex-shrink | "" |
positionProps | t | top | percentageOrPixel |
"" | b | bottom | "" |
"" | l | left | "" |
"" | r | right | "" |
"" | x | r and l | "" |
"" | y | t and b | "" |
"" | ct | cells top | getCells |
"" | cb | cells bottom | "" |
"" | cl | cells left | "" |
"" | cr | cells right | "" |
"" | cx | cr and cl | "" |
"" | cy | ct and cb | "" |
"" | position | position | |
"" | z | z-index | |
textProps | color | color | |
"" | textAlign | text-align | |
"" | textTransform | text-transform | |
"" | fontFamily | font-family | |
"" | fontSize | font-size | percentageOrPixel |
"" | fontWeight | font-weight | |
"" | lineHeight | line-height |
All of the sharedProps can take a single value, or an object of Breakpoints. You have all the choices you could possibly use for creating style within breakpoints. This system is mobile first, but there's several ways to mix it up.
Let's using the width
css property for the following examples...
w={50}
If you want to create a breakpoint, supply an object, and use the key as the breakpoint. Make sure to give the lowest a 0
, if it's min-width 0, it won't wrap it in a media query.
w={{ 0: 50, 768: 100, 1024: 150 }}
returns
width: 50px;
@media (min-width: 768px) {
width: 100px;
}
@media (min-width: 1024px) {
width: 150px;
}
If you want to create a breakpoint that has min and max, supply a key that is a string like so...
w={{ '768-1024': 100 }}
returns
@media (min-width: 768px) and (max-width: 1024px) {
width: 100px;
}
Pretty cool, eh?
This min-max string key is how the scaling pixel values work. If you wanted to scale anything from one pixel value to another, like font-size
for instance, you can do this...
fontSize={{
0: 12,
'414-1023': { min: 12, max: 36 },
1024: 36
}}
returns
font-size: 12px;
@media (min-width: 414px) and (max-width: 1023px) {
A css formula to scale the font-size from 12px to 36px based on screen width
}
@media (min-width: 1024px) {
font-size: 36px;
}
Notice the conversionType
? This should clue you into what is possible for the given prop.
You can pass is an int
like 50
and it'll convert to 50px
. You can pass it a fraction, like 1 / 2
and it'll convert to a 50%
. You can also just pass a string like 50em
.
Used for grow and shrink, if you pass true
, it'll convert to 1
for css purposes. And false
to 0
.
This takes an int
and converts it to the cells width (or height). Thus cw={2}
makes the element 2 cells wide (based on your grid config).
Similar to getCells
, but takes an object. ctransform={{ 0: {x: 0.5, y: 0} }}
would offset the x coords of the element by 1/2 cells width.
Flex has some pretty unintuitive properties. For instance, valign="top"
refers to the vertical alignment an element (assuming you staying with direction=row). You can of course pass the original css flex properties as well if you are used to them.
input | output |
---|---|
top | flex-start |
left | flex-start |
start | flex-start |
bottom | flex-end |
right | flex-end |
end | flex-end |
middle | center |
center | center |
FAQs
Styled-Velocity, a React-based styled prop and UI library to increase your velocity and help build your Design System.
The npm package styled-velocity receives a total of 24 weekly downloads. As such, styled-velocity popularity was classified as not popular.
We found that styled-velocity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.