Skip to content

Commit 4597145

Browse files
committed
refactor: rename 'modal' component to 'drawer' -- refactor and port over as a new Preact component.
1 parent 1680f5f commit 4597145

File tree

9 files changed

+388
-172
lines changed

9 files changed

+388
-172
lines changed

packages/uikit-workshop/src/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<!-- wrapper so the iframe + modal can switch flex directions in vertical vs horizontal layouts -->
1919
<div class="pl-c-viewport-modal-wrapper">
2020
${require('./partials/iframe.html') }
21-
${require('./partials/modal.html') }
21+
<pl-drawer></pl-drawer>
2222
</div>
2323
</pl-layout>
2424

packages/uikit-workshop/src/sass/scss/05-themes/_light-theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
/**
104104
* Modal inside a light theme
105105
*/
106-
.pl-c-modal {
106+
.pl-c-drawer {
107107
background-color: $pl-color-white;
108108
color: $pl-color-gray-70;
109109
border-top: 1px solid $pl-color-gray-20;
@@ -113,7 +113,7 @@
113113
* Modal close button
114114
* 1) Closes the modal popup
115115
*/
116-
.pl-c-modal__close-btn,
116+
.pl-c-drawer__close-btn,
117117
.pl-c-tools__action {
118118
background-color: $pl-color-white;
119119

packages/uikit-workshop/src/sass/scss/05-themes/_sidebar-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
* so it fits in remaining available space
176176
* TODO: revisit to find ways to resize
177177
*/
178-
.pl-c-modal {
178+
.pl-c-drawer {
179179
right: 0; /* 1 */
180180
width: auto;
181181
}

packages/uikit-workshop/src/scripts/actions/app.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
export const UPDATE_THEME_MODE = 'UPDATE_THEME_MODE';
22
export const UPDATE_LAYOUT_MODE = 'UPDATE_LAYOUT_MODE';
3+
export const UPDATE_DRAWER_ANIMATION_STATE = 'UPDATE_DRAWER_ANIMATION_STATE';
4+
export const UPDATE_DRAWER_STATE = 'UPDATE_DRAWER_STATE';
5+
export const UPDATE_DRAWER_HEIGHT = 'UPDATE_DRAWER_HEIGHT';
6+
export const IS_VIEWALL_PAGE = 'IS_VIEWALL_PAGE';
37

48
export const updateLayoutMode = layoutMode => (dispatch, getState) => {
59
if (getState().app.layoutMode !== layoutMode) {
@@ -18,3 +22,42 @@ export const updateThemeMode = themeMode => (dispatch, getState) => {
1822
});
1923
}
2024
};
25+
26+
export const updateDrawerState = opened => (dispatch, getState) => {
27+
if (getState().app.drawerOpened !== opened) {
28+
dispatch({
29+
type: UPDATE_DRAWER_STATE,
30+
opened,
31+
});
32+
}
33+
};
34+
35+
export const updateDrawerAnimationState = drawerIsAnimating => (
36+
dispatch,
37+
getState
38+
) => {
39+
if (getState().app.drawerIsAnimating !== drawerIsAnimating) {
40+
dispatch({
41+
type: UPDATE_DRAWER_ANIMATION_STATE,
42+
drawerIsAnimating,
43+
});
44+
}
45+
};
46+
47+
export const updateDrawerHeight = height => (dispatch, getState) => {
48+
if (getState().app.drawerHeight !== height) {
49+
dispatch({
50+
type: UPDATE_DRAWER_HEIGHT,
51+
height,
52+
});
53+
}
54+
};
55+
56+
export const isViewallPage = isViewall => (dispatch, getState) => {
57+
if (getState().app.isViewallPage !== isViewall) {
58+
dispatch({
59+
type: IS_VIEWALL_PAGE,
60+
isViewall,
61+
});
62+
}
63+
};

0 commit comments

Comments
 (0)