-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8311 from amplication/next
Release v1.16.1
- Loading branch information
Showing
38 changed files
with
846 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
.select-field__control { | ||
@include textField; | ||
padding: 0; | ||
height: auto; | ||
|
||
&--is-focused, | ||
&:hover { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/amplication-client/src/Components/ResponsiveContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import classNames from "classnames"; | ||
import { useEffect, useLayoutEffect, useRef, useState } from "react"; | ||
|
||
import useResizeObserver from "@react-hook/resize-observer"; | ||
|
||
const DEFAULT_MIN_WIDTH_CLASSES: { [key: string]: number }[] = [ | ||
{ xxl: 1400 }, | ||
{ xl: 1200 }, | ||
{ lg: 992 }, | ||
{ md: 768 }, | ||
{ sm: 576 }, | ||
]; | ||
|
||
type Props = { | ||
children: React.ReactNode; | ||
className: string; | ||
minWidthClasses?: { [key: string]: number }[]; // the array must be sorted by the breakpoint size, the first breakpoint should be the largest | ||
}; | ||
|
||
const useWidth = (target) => { | ||
const [width, setWidth] = useState(0); | ||
|
||
useLayoutEffect(() => { | ||
setWidth(target.current.getBoundingClientRect()); | ||
}, [target]); | ||
|
||
useResizeObserver(target, (entry) => setWidth(entry.contentRect.width)); | ||
return width; | ||
}; | ||
|
||
function ResponsiveContainer({ | ||
children, | ||
className, | ||
minWidthClasses = DEFAULT_MIN_WIDTH_CLASSES, | ||
}: Props) { | ||
const divRef = useRef(null); | ||
const width = useWidth(divRef); | ||
|
||
const [responsiveClassName, setResponsiveClassName] = useState<string>(""); | ||
|
||
useEffect(() => { | ||
if (minWidthClasses) { | ||
const breakPoint = minWidthClasses.filter( | ||
(minWidthClass) => width > Object.values(minWidthClass)[0] | ||
); | ||
|
||
const classes = breakPoint.map( | ||
(minWidthClass) => `${className}--${Object.keys(minWidthClass)[0]}` | ||
); | ||
|
||
setResponsiveClassName(classes.join(" ")); | ||
} | ||
}, [className, minWidthClasses, width]); | ||
|
||
return ( | ||
<div ref={divRef} className={classNames(className, responsiveClassName)}> | ||
{children} | ||
</div> | ||
); | ||
} | ||
|
||
export default ResponsiveContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/amplication-client/src/Workspaces/WorkspaceOverview.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@import "../style/index.scss"; | ||
|
||
.workspaces-layout__main_content--xl { | ||
.workspace-overview { | ||
&__content { | ||
flex-direction: row; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.