1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-05 05:37:29 +02:00

Add validation icon pattern

This commit is contained in:
Phuoc Nguyen
2019-12-12 20:16:59 +07:00
parent 848909587c
commit f81388b133
6 changed files with 207 additions and 2 deletions

View File

@@ -62,6 +62,7 @@ enum Pattern {
Tab = 'Tab',
TogglePasswordVisibility = 'Toggle password visibility',
UploadButton = 'Upload button',
ValidationIcon = 'Validation icon',
Wizard = 'Wizard',
}

View File

@@ -62,7 +62,7 @@ const ExplorePage = () => {
textAlign: 'center',
}}
>
Here is the collection of 64 patterns
Here is the collection of 65 patterns
</h2>
<div style={{ marginBottom: '32px', textAlign: 'center' }}>
All covers you see in this page are made with CSS only. Inspect them! 🎉
@@ -168,6 +168,7 @@ const ExplorePage = () => {
<CoverCard pattern={Pattern.RadialProgressBar} />
<CoverCard pattern={Pattern.ResizableElement} />
<CoverCard pattern={Pattern.PresenceIndicator} />
<CoverCard pattern={Pattern.ValidationIcon} />
</div>
</section>
</div>

View File

@@ -170,7 +170,7 @@ const HomePage = () => {
marginBottom: '16px',
}}
>
64 patterns
65 patterns
</div>
<Link
to="/patterns"

View File

@@ -0,0 +1,56 @@
import React from 'react';
import Frame from '../../placeholders/Frame';
const Cover: React.FC<{}> = () => {
return (
<Frame>
<div
style={{
alignItems: 'center',
display: 'flex',
flexDirection: 'column',
height: '100%',
justifyContent: 'center',
padding: '8px',
}}
>
<div
style={{
border: '1px solid rgba(0, 0, 0, 0.3)',
borderRadius: '4px',
height: '32px',
position: 'relative',
width: '100%',
}}
>
<i
style={{
position: 'absolute',
right: '4px',
top: '50%',
transform: 'translate(0, -50%)',
}}
>
<svg
viewBox="0 0 24 24"
style={{
fill: 'none',
height: '16px',
stroke: "rgba(0, 0, 0, 0.5)",
strokeLinecap: 'round',
strokeLinejoin: 'round',
strokeWidth: 1,
width: '16px',
}}
>
<path d={`M23.5,0.499l-16.5,23l-6.5-6.5`} />
</svg>
</i>
</div>
</div>
</Frame>
);
};
export default Cover;

View File

@@ -0,0 +1,146 @@
import React from 'react';
import DetailsLayout from '../../layouts/DetailsLayout';
import BrowserFrame from '../../placeholders/BrowserFrame';
const Details: React.FC<{}> = () => {
return (
<DetailsLayout title="Validation icon">
<div style={{ padding: '64px 32px' }}>
<BrowserFrame
content={(
<div
style={{
alignItems: 'center',
display: 'flex',
flexDirection: 'column',
height: '100%',
justifyContent: 'center',
padding: '8px',
}}
>
<div
style={{
marginBottom: '16px',
position: 'relative',
width: '200px',
}}
>
<input
style={{
border: '1px solid rgba(0, 0, 0, 0.3)',
borderRadius: '4px',
height: '32px',
paddingRight: '24px',
width: '100%',
}}
/>
<i
style={{
position: 'absolute',
right: '8px',
top: '50%',
transform: 'translate(0, -50%)',
zIndex: 10,
}}
>
<svg
viewBox="0 0 24 24"
style={{
fill: 'none',
height: '16px',
stroke: "rgba(0, 0, 0, 0.5)",
strokeLinecap: 'round',
strokeLinejoin: 'round',
strokeWidth: 2,
width: '16px',
}}
>
<path d={`M23.5,0.499l-16.5,23l-6.5-6.5`} />
</svg>
</i>
</div>
<div
style={{
marginBottom: '16px',
position: 'relative',
width: '200px',
}}
>
<input
style={{
border: '1px solid rgba(0, 0, 0, 0.3)',
borderRadius: '4px',
height: '32px',
paddingRight: '24px',
width: '100%',
}}
/>
<i
style={{
position: 'absolute',
right: '8px',
top: '50%',
transform: 'translate(0, -50%)',
zIndex: 10,
}}
>
<svg
viewBox="0 0 24 24"
style={{
fill: 'none',
height: '16px',
stroke: '#e7040f',
strokeLinecap: 'round',
strokeLinejoin: 'round',
strokeWidth: 2,
width: '16px',
}}
>
<path d={`M0.5,0.499l23,23 M23.5,0.499l-23,23`} />
</svg>
</i>
</div>
</div>
)}
source={`
<div style="
/* Used to position the validation icon */
position: relative;
">
<!-- The input -->
<input style="
/* Border */
border: 1px solid rgba(0, 0, 0, 0.3);
border-radius: 4px;
/* Take the full width */
width: 100%;
/* Don't overlap the icon */
padding-right: 24px;
" />
<!-- The icon container -->
<i style="
/* Positioned at the right side */
position: absolute;
right: 8px;
top: 50%;
transform: translate(0, -50%);
z-index: 10;
">
<!-- The SVG icon represents any state such as valid, invalid, loading, etc. -->
...
</i>
</div>
`}
/>
</div>
</DetailsLayout>
);
};
export default Details;

View File

@@ -63,5 +63,6 @@
<url><loc>https://csslayout.io/patterns/tab</loc></url>
<url><loc>https://csslayout.io/patterns/toggle-password-visibility</loc></url>
<url><loc>https://csslayout.io/patterns/upload-button</loc></url>
<url><loc>https://csslayout.io/patterns/validation-icon</loc></url>
<url><loc>https://csslayout.io/patterns/wizard</loc></url>
</urlset>