Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/EPMUII-5022 Responsiveness - Global layout #166

Merged
merged 18 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions src/engine/Graphics2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,18 +691,40 @@ class Graphics2d extends React.Component {
this.m_sliceRatio = this.props.sliderValue;
this.m_mode2d = this.props.mode2d;

const isLandscape = window.matchMedia('(orientation: landscape)').matches;

const wrapperStyles = {
display: 'flex',
justifyContent: 'flex-start',
width: `calc(100% - 110px)`,
height: `calc(100% - 110px)`,
margin: '100px 125px',
width: '100%',
height: '100%',
justifyContent: 'center',
overflow: 'scroll',
padding: '0',
};

const canvasStyles = {
maxWidth: '100%',
display: 'block',
width: '150vw',
height: '100%',
margin: '0',
padding: '0',
border: '2px solid #dc5e47',
borderRadius: '10px',
};

if (window.innerWidth < 768) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we cannot add these styles using CSS only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion!Will do it

wrapperStyles.height = `calc(100% - 5rem)`;
canvasStyles.width = '150vw';
canvasStyles.height = '100%';
} else if (window.innerWidth >= 768) {
if (isLandscape && window.innerWidth >= 1024) {
wrapperStyles.width = 'calc(100% - 3rem)';
canvasStyles.width = '70%';
canvasStyles.height = 'calc(100% - 0.5rem)';
} else {
canvasStyles.width = '80vw';
canvasStyles.height = 'calc(100% - 3rem)';
}
}
return (
<div style={wrapperStyles}>
<canvas
Expand Down
2 changes: 2 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ body {
margin: 0;
padding: 0;
font-family: 'Inter', sans-serif;
font-size: 15px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
height: 100vh;
Expand All @@ -28,6 +29,7 @@ code {
--black: #18191b;

/* Additional colors */
--beige: #f4f2ea;
--gray: #636666;
--dark-gray: #282a2d;
--dark-gray2: #46494e;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Button/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const UIButton = ({ icon, caption, handler, active, rounded, type, mode,
caption={icon && caption}
>
{icon ? <SVG name={icon} title={caption} /> : caption}
{text ? text : ''}
{text ? <span>{text}</span> : ''}
</ButtonContainer>
);
};
Expand Down
216 changes: 164 additions & 52 deletions src/ui/Button/Button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,60 @@
* SPDX-License-Identifier: Apache-2.0
*/

.button.light svg {
fill: var(--black);
}

button:hover,
.button:focus {
background-color: var(--light-orange);
}

.button.active {
color: var(--red);
}
.apply {
background-color: var(--red);
border-radius: 4px;
}

.button.active svg {
fill: var(--red);
}

.button.light {
color: var(--black);
background-color: var(--light);
}

.button.light svg {
fill: var(--black);
}

.button.light.active {
color: var(--red);
}

.button.light:hover,
.button.light:focus {
background-color: var(--light);
filter: brightness(80%);
}

.button.accent {
color: var(--white);
background-color: var(--red);
}



@media screen and (min-width: 768px) {
.reset {
display: flex;
justify-content: end;
}

}
.reset {
display: inline-block;
border: none;
Expand Down Expand Up @@ -53,58 +107,116 @@
fill: var(--white);
}

.button:hover,
.button:focus {
background-color: var(--light-orange);
}

.button.active {
color: var(--red);
}

.apply {
background-color: var(--red);
border-radius: 4px;
}

.button.active svg {
fill: var(--red);
}

.button.light {
color: var(--black);
background-color: var(--light);
}
.button:not(.reset) {
display: block;
}

@media screen and (min-width: 1024px) {
.reset {
display: inline-block;
border: none;
margin: 0;
text-decoration: none;
background-color: transparent;
padding: 0;
cursor: pointer;
transition: all 250ms ease-in-out, transform 150ms ease;
-webkit-appearance: none;
-moz-appearance: none;
}

.reset:focus {
outline: none;
}

.button {
margin-right: 5px;
margin-bottom: 5px;
background-color: var(--black);
padding: 12px 13px;
color: var(--white);
font-family: inherit;
text-align: center;
vertical-align: center;
font-size: 14px;
border-radius: 36px;
}

.button > svg {
width: 24px;
height: 24px;
}

.rounded {
overflow: hidden;
border-radius: 50%;
}

.captionButton {
padding: 5px 10px;
font-size: 16px;
line-height: 1.5;
}

.button svg {
fill: var(--white);
}

.button:hover,
.button:focus {
background-color: var(--light-orange);
}

.button.active {
color: var(--red);
}

.apply {
background-color: var(--red);
border-radius: 4px;
}

.button.active svg {
fill: var(--red);
}

.button.light {
color: var(--black);
background-color: var(--light);
}

.button.light svg {
fill: var(--black);
}

.button.light.active {
color: var(--red);
}

.button.light:hover,
.button.light:focus {
background-color: var(--light);
filter: brightness(80%);
}

.button.accent {
color: var(--white);
background-color: var(--red);
}

.button.accent svg {
fill: var(--white);
}

.button.accent:hover,
.button.accent:focus {
background-color: var(--red);
filter: brightness(85%);
}

.button.accent.active svg {
fill: var(--black);
}

.button.light svg {
fill: var(--black);
}

.button.light.active {
color: var(--red);
}

.button.light:hover,
.button.light:focus {
background-color: var(--light);
filter: brightness(80%);
}

.button.accent {
color: var(--white);
background-color: var(--red);
}

.button.accent svg {
fill: var(--white);
}

.button.accent:hover,
.button.accent:focus {
background-color: var(--red);
filter: brightness(85%);
}

.button.accent.active svg {
fill: var(--black);
}
70 changes: 60 additions & 10 deletions src/ui/Layout/Container.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
* Copyright 2021 EPAM Systems, Inc. (https://www.epam.com/)
* SPDX-License-Identifier: Apache-2.0
*/
.vertical {
display: none;
}

.horizontal {
display: block;
}

.container button > svg #clear {
display: block;
color: #18191b;
}
.container {
display: inline-flex;
flex-wrap: wrap;
Expand All @@ -11,18 +22,57 @@
overflow: hidden;
}

.vertical {
flex-direction: column;
width: 50px;
.horizontal button > svg > use[xlinkHref$="#folder"] {
display: none;
}

.vertical:not(:first-child) {
margin-top: 25px;
@media screen and (min-width: 768px) {

.container {
display: inline-flex;
flex-wrap: wrap;
width: fit-content;
border-radius: 10px;
overflow: hidden;
}

.vertical {
flex-direction: column;
width: 50px;
}

.vertical:not(:first-child) {
margin-top: 25px;
}

.container button {
display: flex;
}

.horizontal {
display: none;
}


}

.horizontal {
flex-direction: row;
flex-shrink: 0;
height: 50px;
margin: 0 25px 0 0;
@media screen and (min-width: 1024px) {
.horizontal {
display: flex;
flex-direction: row;
flex-shrink: 0;
height: 50px;
margin: 0 25px 0 0;
}

.container button > svg #clear,
.container button > svg #edit {
display: block;
color: #18191b;
background: red;
}

}



Loading