mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-06 14:16:50 +02:00
Add resizable element pattern
This commit is contained in:
@@ -42,6 +42,7 @@ enum Pattern {
|
|||||||
RadioButtonGroup = 'Radio button group',
|
RadioButtonGroup = 'Radio button group',
|
||||||
RadioSwitch = 'Radio switch',
|
RadioSwitch = 'Radio switch',
|
||||||
Rating = 'Rating',
|
Rating = 'Rating',
|
||||||
|
ResizableElement = 'Resizable element',
|
||||||
Ribbon = 'Ribbon',
|
Ribbon = 'Ribbon',
|
||||||
SameHeightColumns = 'Same height columns',
|
SameHeightColumns = 'Same height columns',
|
||||||
SearchBox = 'Search box',
|
SearchBox = 'Search box',
|
||||||
|
@@ -164,6 +164,7 @@ const ExplorePage = () => {
|
|||||||
<CoverCard pattern={Pattern.PopoverArrow} />
|
<CoverCard pattern={Pattern.PopoverArrow} />
|
||||||
<CoverCard pattern={Pattern.ProgressBar} />
|
<CoverCard pattern={Pattern.ProgressBar} />
|
||||||
<CoverCard pattern={Pattern.RadialProgressBar} />
|
<CoverCard pattern={Pattern.RadialProgressBar} />
|
||||||
|
<CoverCard pattern={Pattern.ResizableElement} />
|
||||||
<CoverCard pattern={Pattern.PresenceIndicator} />
|
<CoverCard pattern={Pattern.PresenceIndicator} />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@@ -170,7 +170,7 @@ const HomePage = () => {
|
|||||||
marginBottom: '16px',
|
marginBottom: '16px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
60+ patterns
|
62 patterns
|
||||||
</div>
|
</div>
|
||||||
<Link
|
<Link
|
||||||
to="/patterns"
|
to="/patterns"
|
||||||
|
128
client/patterns/resizable-element/Cover.tsx
Normal file
128
client/patterns/resizable-element/Cover.tsx
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
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: '16px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px dashed rgba(0, 0, 0, 0.3)',
|
||||||
|
height: '100%',
|
||||||
|
position: 'relative',
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'nwse-resize',
|
||||||
|
height: '12px',
|
||||||
|
left: 0,
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'ns-resize',
|
||||||
|
height: '12px',
|
||||||
|
left: '50%',
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'nesw-resize',
|
||||||
|
height: '12px',
|
||||||
|
position: 'absolute',
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
transform: 'translate(50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'ew-resize',
|
||||||
|
height: '12px',
|
||||||
|
position: 'absolute',
|
||||||
|
right: 0,
|
||||||
|
top: '50%',
|
||||||
|
transform: 'translate(50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
bottom: 0,
|
||||||
|
cursor: 'nwse-resize',
|
||||||
|
height: '12px',
|
||||||
|
position: 'absolute',
|
||||||
|
right: 0,
|
||||||
|
transform: 'translate(50%, 50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
bottom: 0,
|
||||||
|
cursor: 'ns-resize',
|
||||||
|
height: '12px',
|
||||||
|
position: 'absolute',
|
||||||
|
right: '50%',
|
||||||
|
transform: 'translate(50%, 50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
bottom: 0,
|
||||||
|
cursor: 'nesw-resize',
|
||||||
|
height: '12px',
|
||||||
|
left: 0,
|
||||||
|
position: 'absolute',
|
||||||
|
transform: 'translate(-50%, 50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'ew-resize',
|
||||||
|
height: '12px',
|
||||||
|
left: 0,
|
||||||
|
position: 'absolute',
|
||||||
|
top: '50%',
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Frame>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Cover;
|
303
client/patterns/resizable-element/Details.tsx
Normal file
303
client/patterns/resizable-element/Details.tsx
Normal file
@@ -0,0 +1,303 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import DetailsLayout from '../../layouts/DetailsLayout';
|
||||||
|
import BrowserFrame from '../../placeholders/BrowserFrame';
|
||||||
|
|
||||||
|
const Details: React.FC<{}> = () => {
|
||||||
|
return (
|
||||||
|
<DetailsLayout title="Resizable element">
|
||||||
|
<div style={{ padding: '64px 32px' }}>
|
||||||
|
<div style={{ lineHeight: 1.5, marginBottom: '16px' }}>
|
||||||
|
You can move the mouse over each squares located at the corners and the middle of sides to see
|
||||||
|
the cursors which indicate the associated side can be resized.
|
||||||
|
</div>
|
||||||
|
<BrowserFrame
|
||||||
|
content={(
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
alignItems: 'center',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
height: '100%',
|
||||||
|
justifyContent: 'center',
|
||||||
|
padding: '8px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px dashed rgba(0, 0, 0, 0.3)',
|
||||||
|
height: '200px',
|
||||||
|
position: 'relative',
|
||||||
|
width: '200px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'nwse-resize',
|
||||||
|
height: '12px',
|
||||||
|
left: 0,
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'ns-resize',
|
||||||
|
height: '12px',
|
||||||
|
left: '50%',
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'nesw-resize',
|
||||||
|
height: '12px',
|
||||||
|
position: 'absolute',
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
transform: 'translate(50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'ew-resize',
|
||||||
|
height: '12px',
|
||||||
|
position: 'absolute',
|
||||||
|
right: 0,
|
||||||
|
top: '50%',
|
||||||
|
transform: 'translate(50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
bottom: 0,
|
||||||
|
cursor: 'nwse-resize',
|
||||||
|
height: '12px',
|
||||||
|
position: 'absolute',
|
||||||
|
right: 0,
|
||||||
|
transform: 'translate(50%, 50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
bottom: 0,
|
||||||
|
cursor: 'ns-resize',
|
||||||
|
height: '12px',
|
||||||
|
position: 'absolute',
|
||||||
|
right: '50%',
|
||||||
|
transform: 'translate(50%, 50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
bottom: 0,
|
||||||
|
cursor: 'nesw-resize',
|
||||||
|
height: '12px',
|
||||||
|
left: 0,
|
||||||
|
position: 'absolute',
|
||||||
|
transform: 'translate(-50%, 50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||||
|
cursor: 'ew-resize',
|
||||||
|
height: '12px',
|
||||||
|
left: 0,
|
||||||
|
position: 'absolute',
|
||||||
|
top: '50%',
|
||||||
|
transform: 'translate(-50%, -50%)',
|
||||||
|
width: '12px',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
source={`
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px dashed rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Used to position the squares */
|
||||||
|
position: relative;
|
||||||
|
">
|
||||||
|
<!-- The content -->
|
||||||
|
...
|
||||||
|
|
||||||
|
<!-- The top left square -->
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Resize cursor */
|
||||||
|
cursor: nwse-resize;
|
||||||
|
|
||||||
|
/* Positioned at the top left corner */
|
||||||
|
left: 0px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
"/>
|
||||||
|
|
||||||
|
<!-- The top square -->
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Resize cursor */
|
||||||
|
cursor: ns-resize;
|
||||||
|
|
||||||
|
/* Positioned at the middle of top side */
|
||||||
|
left: 50%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
"/>
|
||||||
|
|
||||||
|
<!-- The top right square -->
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Resize cursor */
|
||||||
|
cursor: nesw-resize;
|
||||||
|
|
||||||
|
/* Positioned at the top right corner */
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
top: 0px;
|
||||||
|
transform: translate(50%, -50%);
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
"/>
|
||||||
|
|
||||||
|
<!-- The right square -->
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Resize cursor */
|
||||||
|
cursor: ew-resize;
|
||||||
|
|
||||||
|
/* Positioned at the middle of right side */
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(50%, -50%);
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
"/>
|
||||||
|
|
||||||
|
<!-- The right bottom square -->
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Resize cursor */
|
||||||
|
cursor: nwse-resize;
|
||||||
|
|
||||||
|
/* Positioned at the right bottom corner */
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
transform: translate(50%, 50%);
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
"/>
|
||||||
|
|
||||||
|
<!-- The bottom square -->
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Resize cursor */
|
||||||
|
cursor: ns-resize;
|
||||||
|
|
||||||
|
/* Positioned at the middle of bottom side */
|
||||||
|
bottom: 0px;
|
||||||
|
position: absolute;
|
||||||
|
right: 50%;
|
||||||
|
transform: translate(50%, 50%);
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
"/>
|
||||||
|
|
||||||
|
<!-- The bottom left square -->
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Resize cursor */
|
||||||
|
cursor: nesw-resize;
|
||||||
|
|
||||||
|
/* Positioned at the bottom left corner */
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0px;
|
||||||
|
position: absolute;
|
||||||
|
transform: translate(-50%, 50%);
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
"/>
|
||||||
|
|
||||||
|
<!-- The left square -->
|
||||||
|
<div style="
|
||||||
|
/* Border */
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
/* Resize cursor */
|
||||||
|
cursor: ew-resize;
|
||||||
|
|
||||||
|
/* Positioned at the middle of left side */
|
||||||
|
left: 0px;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 12px;
|
||||||
|
width: 12px;
|
||||||
|
"/>
|
||||||
|
</div>
|
||||||
|
`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</DetailsLayout>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Details;
|
@@ -47,6 +47,7 @@
|
|||||||
<url><loc>https://csslayout.io/patterns/radio-button-group</loc></url>
|
<url><loc>https://csslayout.io/patterns/radio-button-group</loc></url>
|
||||||
<url><loc>https://csslayout.io/patterns/radio-switch</loc></url>
|
<url><loc>https://csslayout.io/patterns/radio-switch</loc></url>
|
||||||
<url><loc>https://csslayout.io/patterns/rating</loc></url>
|
<url><loc>https://csslayout.io/patterns/rating</loc></url>
|
||||||
|
<url><loc>https://csslayout.io/patterns/resizable-element</loc></url>
|
||||||
<url><loc>https://csslayout.io/patterns/ribbon</loc></url>
|
<url><loc>https://csslayout.io/patterns/ribbon</loc></url>
|
||||||
<url><loc>https://csslayout.io/patterns/same-height-columns</loc></url>
|
<url><loc>https://csslayout.io/patterns/same-height-columns</loc></url>
|
||||||
<url><loc>https://csslayout.io/patterns/search-box</loc></url>
|
<url><loc>https://csslayout.io/patterns/search-box</loc></url>
|
||||||
|
Reference in New Issue
Block a user