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

UI: Overhaul layout engine #20412

Merged
merged 77 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
ae1d7a1
making changes
ndelangen Dec 21, 2022
eafbdfb
improvements
ndelangen Dec 22, 2022
0604499
make zoom work nicer
ndelangen Dec 22, 2022
44bbd4f
use proper mobile nav bar
ndelangen Dec 22, 2022
69f307b
Merge branch 'next' into norbert/panel-size
ndelangen Dec 23, 2022
544bc47
connect it up to global state
ndelangen Dec 23, 2022
0773caf
improvements
ndelangen Dec 24, 2022
c354cab
cleanup
ndelangen Dec 25, 2022
f2bed35
fix react warning
ndelangen Dec 25, 2022
83ac400
replace the old
ndelangen Dec 25, 2022
d534e08
Merge branch 'next' into norbert/panel-size
ndelangen Dec 25, 2022
5bad257
cleanup
ndelangen Dec 25, 2022
7fdfd4c
rename part 1
ndelangen Dec 25, 2022
4e6ec72
renames part 2
ndelangen Dec 25, 2022
4671b08
rename part 3
ndelangen Dec 25, 2022
751398e
rename part 4
ndelangen Dec 25, 2022
6ec8679
set parameters for preview component
ndelangen Dec 25, 2022
6874797
remove viewports 900
ndelangen Dec 25, 2022
f335da2
this doesn't seem to work, let's just drop it or now
ndelangen Dec 25, 2022
e968a55
rename & fix mobile not having background behind panel and sidebar
ndelangen Dec 26, 2022
cb8401f
more renaming as requested
ndelangen Dec 26, 2022
dc98ac6
changes according to review comments, remove immer
ndelangen Jan 5, 2023
ff89ba3
Merge branch 'next' into norbert/panel-size
ndelangen Jan 5, 2023
8503c33
make it a named export
ndelangen Jan 5, 2023
b4cda79
rename files
ndelangen Jan 5, 2023
e55e071
deal with renames, and change to named export
ndelangen Jan 5, 2023
2f6ef15
Merge branch 'next' into norbert/panel-size
ndelangen Jan 19, 2023
f38ab2a
renamed styles and improved vertical drag to be smoother
jd-oconnor Jan 20, 2023
c85f29b
moved hook and refactored reducer
jd-oconnor Jan 20, 2023
a7ae4e9
smooth dragging
jd-oconnor Jan 22, 2023
9e4eb9c
fixed addon panel positioning getting stuck on right
jd-oconnor Jan 22, 2023
38defc1
added border to panel and changed some colors
jd-oconnor Jan 22, 2023
fcfdf47
softened the blue
jd-oconnor Jan 22, 2023
43b4aa9
fixed panelPosition change disabling drag when switching
jd-oconnor Jan 22, 2023
073f5c6
Merge branch 'next' into norbert/panel-size
ndelangen Jan 26, 2023
b6d42ae
fix linting
ndelangen Jan 26, 2023
06e3c0e
Merge branch 'next' into norbert/panel-size
ndelangen Feb 15, 2023
d0648cd
fix name
ndelangen Feb 15, 2023
ad8c88a
Merge branch 'next' into norbert/panel-size
ndelangen Feb 16, 2023
d159949
Merge branch 'next' into norbert/panel-size
ndelangen Feb 22, 2023
aad4e50
Merge branch 'next' into norbert/panel-size
ndelangen Apr 4, 2023
73c0fb0
Merge branch 'next' of github.com:storybookjs/storybook into norbert/…
JReinhold Sep 11, 2023
13cf54b
fix useMemo warning
JReinhold Sep 12, 2023
27e35c3
layout changes all over the place...
JReinhold Sep 12, 2023
5cfc14e
fix resize with iframe, addon panel never showing
JReinhold Sep 12, 2023
b7a6e84
Improve drag handles
cdedreuille Sep 12, 2023
e307b76
correct reducer persistence.
JReinhold Sep 13, 2023
6de0dfa
Merge branch 'norbert/panel-size' of github.com:storybookjs/storybook…
JReinhold Sep 13, 2023
5722380
Improve drag handles
cdedreuille Sep 13, 2023
515d1f5
Update Layout.tsx
cdedreuille Sep 13, 2023
41a8898
rewrite layout state, syncing with Layout component
JReinhold Sep 13, 2023
c7c07c9
Merge branch 'norbert/panel-size' of github.com:storybookjs/storybook…
JReinhold Sep 13, 2023
2c6f3b9
implement recentVisibleSizes
JReinhold Sep 13, 2023
ffda0d3
use absolute pixels for layout sizing
JReinhold Sep 13, 2023
64cbad2
transition when toggling layouts
JReinhold Sep 14, 2023
507eca1
Remove changes to theming
cdedreuille Sep 14, 2023
6878eaa
Update global.ts
cdedreuille Sep 14, 2023
d2d0a0c
Fix preview height
cdedreuille Sep 15, 2023
29a6fa0
remove unnecessary offset
cdedreuille Sep 15, 2023
1ac2069
Fix some zIndex on the drag handles
cdedreuille Sep 15, 2023
10fc8a5
add min width to sidebar and right panel
JReinhold Sep 15, 2023
e05de67
refactor interpolation
JReinhold Sep 17, 2023
04f046c
better defaults layout sizes
JReinhold Sep 18, 2023
2f4efd2
Fix Toolbar styling
cdedreuille Sep 18, 2023
e40ebfc
Merge branch 'norbert/panel-size' of github.com:storybookjs/storybook…
JReinhold Sep 18, 2023
998f3f5
Merge branch 'next' into norbert/panel-size
cdedreuille Sep 18, 2023
7970677
fix for removing showNav, isFullscreen, showPanel manager states
JReinhold Sep 18, 2023
6c417b8
Merge branch 'norbert/panel-size' of github.com:storybookjs/storybook…
JReinhold Sep 18, 2023
162f69b
add layout tests
JReinhold Sep 18, 2023
c1e87c5
cleanup
JReinhold Sep 18, 2023
47bad99
cleanup
JReinhold Sep 18, 2023
ea7c444
add migration notes for layout state
JReinhold Sep 19, 2023
0b413ac
fix types
JReinhold Sep 19, 2023
e4848a3
Adjust the minimum size of the preview
cdedreuille Sep 19, 2023
d374b91
Remove animations
cdedreuille Sep 19, 2023
5bbc1e0
improve e2e coverage of layout
JReinhold Sep 19, 2023
096a6d2
Merge branch 'norbert/panel-size' of github.com:storybookjs/storybook…
JReinhold Sep 19, 2023
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
44 changes: 23 additions & 21 deletions code/addons/viewport/src/Tool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ const toLinks = memoize(50)((list: ViewportItem[], active: LinkBase, set, state,
});
});

const wrapperId = 'storybook-preview-wrapper';

interface LinkBase {
id: string;
title: string;
Expand Down Expand Up @@ -202,25 +200,29 @@ export const ViewportTool: FC = memo(
<Global
styles={{
[`iframe[data-is-storybook="true"]`]: {
margin: `auto`,
transition: 'none',
position: 'relative',
border: `1px solid black`,
boxShadow: '0 0 100px 100vw rgba(0,0,0,0.5)',

...styles,
},
[`#${wrapperId}`]: {
padding: theme.layoutMargin,
alignContent: 'center',
alignItems: 'center',
justifyContent: 'center',
justifyItems: 'center',
overflow: 'auto',

display: 'grid',
gridTemplateColumns: '100%',
gridTemplateRows: '100%',
...(styles || {
width: '100%',
height: '100%',
}),
// margin: `auto`,
// transition: 'none',
// position: 'relative',
// border: `1px solid black`,
// boxShadow: '0 0 100px 100vw rgba(0,0,0,0.5)',

// ...styles,
// },
// [`#${wrapperId}`]: {
// padding: theme.layoutMargin,
// alignContent: 'center',
// alignItems: 'center',
// justifyContent: 'center',
// justifyItems: 'center',
// overflow: 'auto',

// display: 'grid',
// gridTemplateColumns: '100%',
// gridTemplateRows: '100%',
},
}}
/>
Expand Down
5 changes: 3 additions & 2 deletions code/e2e-tests/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export class SbPage {
const storeState = {
layout: {
showToolbar: true,
showNav: true,
showPanel: true,
navSize: 300,
bottomPanelHeight: 300,
rightPanelWidth: 300,
},
};
window.sessionStorage.setItem('@storybook/manager/store', JSON.stringify(storeState));
Expand Down
14 changes: 7 additions & 7 deletions code/lib/manager-api/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,25 +288,25 @@ function ManagerConsumer<P = Combo>({
filter = defaultFilter,
children,
}: ManagerConsumerProps<P>): ReactElement {
const c = useContext(ManagerContext);
const managerContext = useContext(ManagerContext);
const renderer = useRef(children);
const filterer = useRef(filter);

if (typeof renderer.current !== 'function') {
return <Fragment>{renderer.current}</Fragment>;
}

const data = filterer.current(c);
const comboData = filterer.current(managerContext);

const l = useMemo(() => {
return [...Object.entries(data).reduce((acc, keyval) => acc.concat(keyval), [])];
}, [c.state]);
const comboDataArray = useMemo(() => {
return [...Object.entries(comboData).reduce((acc, keyval) => acc.concat(keyval), [])];
}, [managerContext.state]);

return useMemo(() => {
const Child = renderer.current as FC<P>;

return <Child {...data} />;
}, l);
return <Child {...comboData} />;
}, comboDataArray);
}

export function useStorybookState(): State {
Expand Down
Loading
Loading