playbook_ui_docs 14.25.0.pre.alpha.testingcss10064 → 14.25.0.pre.rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +2 -16
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +8 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.jsx +41 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +33 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +78 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +3 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +26 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +20 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.jsx +59 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +24 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +61 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +24 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +21 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +54 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +1 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +49 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.jsx +99 -0
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +20 -0
- data/app/pb_kits/playbook/pb_drawer/docs/index.js +7 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +2 -3
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.html.erb +1 -12
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.jsx +1 -26
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.md +9 -0
- data/app/pb_kits/playbook/pb_map/docs/_map_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_with_custom_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_map/docs/_map_with_plugin.jsx +1 -1
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +3 -0
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.jsx +1 -3
- data/app/pb_kits/playbook/pb_user/docs/_user_props_table.md +7 -14
- data/dist/playbook-doc.js +2 -2
- metadata +21 -15
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +0 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +0 -24
- data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +0 -3
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +0 -22
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +0 -43
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +0 -1
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap_rails.md +0 -11
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap_react.md +0 -11
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +0 -112
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 874ed8c9f3437a3c991e142fbfb085433782b65d49c600e48b588b1a469d89c5
|
4
|
+
data.tar.gz: cb13f3345acc62c8eb1653c988b8de177bdedd9082762fa8a85f91dbf612d763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9d9f046c5badb3b704b4fc9aabd4ed52c977afc71192135959284400fa8e120569abf5c913238432e8779b9349f12544a7bfdb329586c7eb9fe692d713b79c1
|
7
|
+
data.tar.gz: 6e2c8a86d238f41dcc34f2ba3242dc0b0c2560fcf167ea4ccfaf4d8f8db0fa8ce48814352b96eb9b1cbdae4480ef01767cfaf6db66cebadef5b6450a851b1533
|
@@ -68,10 +68,8 @@ examples:
|
|
68
68
|
- advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
|
69
69
|
- advanced_table_scrollbar_none: Advanced Table Scrollbar None
|
70
70
|
- advanced_table_row_styling: Row Styling
|
71
|
-
- advanced_table_padding_control_per_row: Padding Control using Row Styling
|
72
71
|
- advanced_table_column_styling: Column Styling
|
73
72
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
74
|
-
- advanced_table_padding_control: Padding Control using Column Styling
|
75
73
|
- advanced_table_column_border_color: Column Group Border Color
|
76
74
|
- advanced_table_fullscreen: Fullscreen
|
77
75
|
- advanced_table_infinite_scroll: Infinite Scroll
|
@@ -43,6 +43,4 @@ export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_c
|
|
43
43
|
export { default as AdvancedTableCustomSort } from './_advanced_table_custom_sort.jsx'
|
44
44
|
export { default as AdvancedTableWithCustomHeaderMultiHeader } from './_advanced_table_with_custom_header_multi_header.jsx'
|
45
45
|
export { default as AdvancedTableSortPerColumn } from './_advanced_table_sort_per_column.jsx'
|
46
|
-
export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
|
47
|
-
export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
|
48
|
-
export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
|
46
|
+
export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced_table_sort_per_column_for_multi_column.jsx'
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<% end %>
|
51
51
|
|
52
52
|
<%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %>
|
53
|
-
<%= pb_rails("card/card_header", props: { padding: "sm", header_color: "
|
53
|
+
<%= pb_rails("card/card_header", props: { padding: "sm", header_color: "bg_dark" }) do %>
|
54
54
|
<%= pb_rails("body", props: { text: "Dark", dark: true }) %>
|
55
55
|
<% end %>
|
56
56
|
<%= pb_rails("card/card_body", props: { padding: "md" }) do %>
|
@@ -21,27 +21,13 @@
|
|
21
21
|
let currentClass = okayLoadingButton.className;
|
22
22
|
let cancelClass = cancelButton ? cancelButton.className : "";
|
23
23
|
|
24
|
-
okayLoadingButton.disabled = true;
|
25
|
-
okayLoadingButton.classList.add("pb_button_loading");
|
26
|
-
okayLoadingButton.classList.remove("pb_button_enabled");
|
27
|
-
okayLoadingButton.classList.add("pb_button_disabled");
|
28
|
-
|
29
|
-
if (cancelButton) {
|
30
|
-
cancelButton.disabled = true;
|
31
|
-
cancelButton.classList.remove("pb_button_enabled");
|
32
|
-
cancelButton.classList.add("pb_button_disabled");
|
33
|
-
}
|
34
|
-
|
35
24
|
setTimeout(function() {
|
36
25
|
okayLoadingButton.disabled = false;
|
37
|
-
okayLoadingButton.
|
38
|
-
okayLoadingButton.classList.remove("pb_button_disabled");
|
39
|
-
okayLoadingButton.classList.add("pb_button_enabled");
|
26
|
+
okayLoadingButton.className = currentClass.replace("_disabled_loading", "_enabled");
|
40
27
|
|
41
28
|
if (cancelButton) {
|
42
29
|
cancelButton.disabled = false;
|
43
|
-
cancelButton.
|
44
|
-
cancelButton.classList.add("pb_button_enabled");
|
30
|
+
cancelButton.className = cancelClass.replace("_disabled", "_enabled");
|
45
31
|
}
|
46
32
|
}, 5000);
|
47
33
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import React, { useState } from "react"
|
2
|
+
|
3
|
+
import Button from '../../pb_button/_button'
|
4
|
+
import Drawer from '../../pb_drawer/_drawer'
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
6
|
+
|
7
|
+
const useDrawer = (visible = false) => {
|
8
|
+
const [opened, setOpened] = useState(visible)
|
9
|
+
const toggle = () => setOpened(!opened)
|
10
|
+
|
11
|
+
return [opened, toggle]
|
12
|
+
}
|
13
|
+
|
14
|
+
const DrawerBehavior = () => {
|
15
|
+
const [drawerOpen, toggleDrawerOpen] = useDrawer()
|
16
|
+
|
17
|
+
return (
|
18
|
+
<>
|
19
|
+
<Flex wrap>
|
20
|
+
<Button id='sm'
|
21
|
+
marginRight='md'
|
22
|
+
onClick={toggleDrawerOpen}
|
23
|
+
>
|
24
|
+
{"Push Behavior"}
|
25
|
+
</Button>
|
26
|
+
</Flex>
|
27
|
+
<Flex>
|
28
|
+
<Drawer
|
29
|
+
behavior={"push"}
|
30
|
+
onClose={toggleDrawerOpen}
|
31
|
+
opened={drawerOpen}
|
32
|
+
size={"lg"}
|
33
|
+
>
|
34
|
+
Test me (Push Behavior)
|
35
|
+
</Drawer>
|
36
|
+
</Flex>
|
37
|
+
</>
|
38
|
+
)
|
39
|
+
}
|
40
|
+
|
41
|
+
export default DrawerBehavior
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= pb_rails("flex") do %>
|
2
|
+
<%= pb_rails("button", props: { text: "Drawer with border right", margin_right: "sm", data: {"open-drawer": "drawer-12"} }) %>
|
3
|
+
|
4
|
+
<%= pb_rails("drawer", props: {
|
5
|
+
id:"drawer-12",
|
6
|
+
overlay: false,
|
7
|
+
border: "right"
|
8
|
+
}) do %>
|
9
|
+
Test me (Border Right)
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
|
13
|
+
<%= pb_rails("button", props: { text: "Drawer with border left", margin_right: "sm", data: {"open-drawer": "drawer-13"} }) %>
|
14
|
+
|
15
|
+
<%= pb_rails("drawer", props: {
|
16
|
+
id:"drawer-13",
|
17
|
+
overlay: false,
|
18
|
+
border: "left"
|
19
|
+
}) do %>
|
20
|
+
Test me (Border Left)
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= pb_rails("button", props: { text: "Drawer with border full", data: {"open-drawer": "drawer-14"} }) %>
|
24
|
+
|
25
|
+
<%= pb_rails("drawer", props: {
|
26
|
+
id:"drawer-14",
|
27
|
+
overlay: false,
|
28
|
+
border: "full"
|
29
|
+
}) do %>
|
30
|
+
Test me (Border Full)
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
|
3
|
+
import Button from '../../pb_button/_button'
|
4
|
+
import Drawer from '../../pb_drawer/_drawer'
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
6
|
+
|
7
|
+
const DrawerBorders = () => {
|
8
|
+
// Individual state variables for each drawer size
|
9
|
+
const [openedBRightDrawer, setOpenedBRightDrawer] = useState(false);
|
10
|
+
const [openedBLeftDrawer, setOpenedBLeftDrawer] = useState(false);
|
11
|
+
const [openedBFullDrawer, setOpenedBFullDrawer] = useState(false);
|
12
|
+
|
13
|
+
// Toggle functions for each drawer
|
14
|
+
const toggleBRightDrawer = () => setOpenedBRightDrawer(!openedBRightDrawer);
|
15
|
+
const toggleBLeftDrawer = () => setOpenedBLeftDrawer(!openedBLeftDrawer);
|
16
|
+
const toggleBFullDrawer = () => setOpenedBFullDrawer(!openedBFullDrawer);
|
17
|
+
|
18
|
+
return (
|
19
|
+
<>
|
20
|
+
<Flex
|
21
|
+
wrap
|
22
|
+
>
|
23
|
+
<Button marginRight="md"
|
24
|
+
onClick={toggleBRightDrawer}
|
25
|
+
>
|
26
|
+
Drawer with border right
|
27
|
+
</Button>
|
28
|
+
<Button marginRight="md"
|
29
|
+
onClick={toggleBLeftDrawer}
|
30
|
+
>
|
31
|
+
Drawer with border left
|
32
|
+
</Button>
|
33
|
+
<Button marginRight="md"
|
34
|
+
onClick={toggleBFullDrawer}
|
35
|
+
>
|
36
|
+
Drawer with border full
|
37
|
+
</Button>
|
38
|
+
</Flex>
|
39
|
+
|
40
|
+
{/* Drawers for each size */}
|
41
|
+
<Drawer
|
42
|
+
behavior="float"
|
43
|
+
border="right"
|
44
|
+
onClose={toggleBRightDrawer}
|
45
|
+
opened={openedBRightDrawer}
|
46
|
+
overlay={false}
|
47
|
+
placement="right"
|
48
|
+
size="lg"
|
49
|
+
>
|
50
|
+
This is a Drawer with border right
|
51
|
+
</Drawer>
|
52
|
+
<Drawer
|
53
|
+
behavior="float"
|
54
|
+
border="left"
|
55
|
+
onClose={toggleBLeftDrawer}
|
56
|
+
opened={openedBLeftDrawer}
|
57
|
+
overlay={false}
|
58
|
+
placement="right"
|
59
|
+
size="lg"
|
60
|
+
>
|
61
|
+
This is a Drawer with border left
|
62
|
+
</Drawer>
|
63
|
+
<Drawer
|
64
|
+
behavior="float"
|
65
|
+
border="full"
|
66
|
+
onClose={toggleBFullDrawer}
|
67
|
+
opened={openedBFullDrawer}
|
68
|
+
overlay={false}
|
69
|
+
placement="right"
|
70
|
+
size="lg"
|
71
|
+
>
|
72
|
+
This is a Drawer with border full
|
73
|
+
</Drawer>
|
74
|
+
</>
|
75
|
+
);
|
76
|
+
};
|
77
|
+
|
78
|
+
export default DrawerBorders;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
|
2
|
+
<%= pb_rails("body", props: { text: " The breakpoint prop determines when the Drawer is always visible. Above the specified breakpoint, the Drawer remains open on the page. Below it, only the trigger element is shown, allowing you to toggle the drawer open and closed. To see this in action, click the button below and resize your window.", padding_bottom: "md" }) %>
|
3
|
+
<%= pb_rails("button", props: { text: "Open Doc Example in New Tab", new_window: true, link: "/drawer_page", margin_right: "lg" }) %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import Button from '../../pb_button/_button'
|
3
|
+
import Body from "../../pb_body/_body"
|
4
|
+
|
5
|
+
const DrawerMenu = () => {
|
6
|
+
return (
|
7
|
+
<>
|
8
|
+
<Body>
|
9
|
+
The breakpoint prop determines when the Drawer is always visible. Above
|
10
|
+
the specified breakpoint, the Drawer remains open on the page. Below it,
|
11
|
+
only the trigger element is shown, allowing you to toggle the drawer
|
12
|
+
open and closed. To see this in action, click the button below and
|
13
|
+
resize your window.
|
14
|
+
</Body>
|
15
|
+
<Button
|
16
|
+
link='https://8njdkc.csb.app/'
|
17
|
+
marginTop='md'
|
18
|
+
newWindow
|
19
|
+
>
|
20
|
+
Open Doc Example in New Tab
|
21
|
+
</Button>
|
22
|
+
</>
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
export default DrawerMenu
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= pb_rails("flex") do %>
|
2
|
+
<%= pb_rails("button", props: { text: "Left Drawer", margin_right: "sm", data: {"open-drawer": "drawer-1"} }) %>
|
3
|
+
|
4
|
+
<%= pb_rails("drawer", props: {
|
5
|
+
id:"drawer-1",
|
6
|
+
}) do %>
|
7
|
+
Test me (Left Drawer)
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
|
11
|
+
<%= pb_rails("button", props: { text: "Right Drawer", data: {"open-drawer": "drawer-2"} }) %>
|
12
|
+
|
13
|
+
<%= pb_rails("drawer", props: {
|
14
|
+
id:"drawer-2",
|
15
|
+
placement: "right"
|
16
|
+
}) do %>
|
17
|
+
Test me (Right Drawer)
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
|
3
|
+
import Button from '../../pb_button/_button'
|
4
|
+
import Drawer from '../../pb_drawer/_drawer'
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
6
|
+
|
7
|
+
const useDrawer = (visible = false) => {
|
8
|
+
const [opened, setOpened] = useState(visible);
|
9
|
+
const toggle = () => setOpened(!opened);
|
10
|
+
|
11
|
+
return [opened, toggle];
|
12
|
+
};
|
13
|
+
|
14
|
+
const DrawerDefault = () => {
|
15
|
+
const [drawerLeftOpen, toggleDrawerLeftOpen] = useDrawer();
|
16
|
+
const [drawerRightOpen, toggleDrawerRightOpen ] = useDrawer();
|
17
|
+
|
18
|
+
return (
|
19
|
+
<>
|
20
|
+
<Flex wrap>
|
21
|
+
<Button
|
22
|
+
id="sm"
|
23
|
+
marginRight="md"
|
24
|
+
onClick={toggleDrawerLeftOpen}
|
25
|
+
>
|
26
|
+
{"Left Drawer"}
|
27
|
+
</Button>
|
28
|
+
<Button
|
29
|
+
marginRight="xl"
|
30
|
+
onClick={toggleDrawerRightOpen}
|
31
|
+
>
|
32
|
+
{"Right Drawer"}
|
33
|
+
</Button>
|
34
|
+
</Flex>
|
35
|
+
<Flex>
|
36
|
+
{/* Left Drawer */}
|
37
|
+
<Drawer
|
38
|
+
onClose={toggleDrawerLeftOpen}
|
39
|
+
opened={drawerLeftOpen}
|
40
|
+
size={"lg"}
|
41
|
+
>
|
42
|
+
Test me (Left Drawer)
|
43
|
+
</Drawer>
|
44
|
+
|
45
|
+
{/* Right Drawer */}
|
46
|
+
<Drawer
|
47
|
+
onClose={toggleDrawerRightOpen}
|
48
|
+
opened={drawerRightOpen}
|
49
|
+
placement={"right"}
|
50
|
+
size={"lg"}
|
51
|
+
>
|
52
|
+
Test me (Right Drawer)
|
53
|
+
</Drawer>
|
54
|
+
</Flex>
|
55
|
+
</>
|
56
|
+
);
|
57
|
+
};
|
58
|
+
|
59
|
+
export default DrawerDefault;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= pb_rails("button", props: { padding: "xs", margin_right: "sm", data: {"open-drawer": "drawer-4"} }) do %>
|
2
|
+
<%= pb_rails("icon", props: { icon: "bars", size: "2x" }) %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= pb_rails("drawer", props: {
|
6
|
+
id:"drawer-4",
|
7
|
+
within_element: true,
|
8
|
+
placement: "bottom",
|
9
|
+
breakpoint: "md",
|
10
|
+
size: "full"
|
11
|
+
}) do %>
|
12
|
+
<%= pb_rails("nav", props: { display: {xl: "none", lg: "none", md: "none", sm: "block" } }) do %>
|
13
|
+
<%= pb_rails("nav/item", props: { text: "Photos", link: "#" }) %>
|
14
|
+
<%= pb_rails("nav/item", props: { text: "Music", link: "#" }) %>
|
15
|
+
<%= pb_rails("nav/item", props: { text: "Video", link: "#", active: true }) %>
|
16
|
+
<%= pb_rails("nav/item", props: { text: "Files", link: "#" }) %>
|
17
|
+
<% end %>
|
18
|
+
<%= pb_rails("nav", props: { display: {md: "block", sm: "none", xs: "none" }, orientation: "horizontal" }) do %>
|
19
|
+
<%= pb_rails("nav/item", props: { text: "About", link: "#" }) %>
|
20
|
+
<%= pb_rails("nav/item", props: { text: "Case Studies", link: "#", active: true }) %>
|
21
|
+
<%= pb_rails("nav/item", props: { text: "Service ", link: "#" }) %>
|
22
|
+
<%= pb_rails("nav/item", props: { text: "Contacts", link: "#" }) %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React, { useState, useEffect } from "react"
|
2
|
+
|
3
|
+
import Button from '../../pb_button/_button'
|
4
|
+
import Drawer from '../../pb_drawer/_drawer'
|
5
|
+
import Icon from '../../pb_icon/_icon'
|
6
|
+
import Nav from '../../pb_nav/_nav'
|
7
|
+
import NavItem from '../../pb_nav/_item'
|
8
|
+
|
9
|
+
const DrawerMenu = () => {
|
10
|
+
const [isSmallScreen, setIsSmallScreen] = useState(false)
|
11
|
+
|
12
|
+
useEffect(() => {
|
13
|
+
const mediaQuery = window.matchMedia("(max-width: 600px)")
|
14
|
+
setIsSmallScreen(mediaQuery.matches)
|
15
|
+
const handler = (e) => setIsSmallScreen(e.matches)
|
16
|
+
mediaQuery.addEventListener("change", handler)
|
17
|
+
return () => mediaQuery.removeEventListener("change", handler)
|
18
|
+
}, [])
|
19
|
+
|
20
|
+
return (
|
21
|
+
<div>
|
22
|
+
<Button id='menuButton'
|
23
|
+
padding='xs'
|
24
|
+
>
|
25
|
+
<Icon icon='bars'
|
26
|
+
size='2x'
|
27
|
+
/>
|
28
|
+
</Button>
|
29
|
+
<Drawer
|
30
|
+
breakpoint='md'
|
31
|
+
placement='bottom'
|
32
|
+
size='full'
|
33
|
+
triggerId='menuButton'
|
34
|
+
withinElement
|
35
|
+
>
|
36
|
+
<Nav
|
37
|
+
highlight={false}
|
38
|
+
link='#'
|
39
|
+
orientation={isSmallScreen ? "vertical" : "horizontal"}
|
40
|
+
padding={isSmallScreen ? "none" : "sm"}
|
41
|
+
>
|
42
|
+
<NavItem link='#'
|
43
|
+
text='About'
|
44
|
+
/>
|
45
|
+
<NavItem active
|
46
|
+
link='#'
|
47
|
+
text='Case Studies'
|
48
|
+
/>
|
49
|
+
<NavItem link='#'
|
50
|
+
text='Service'
|
51
|
+
/>
|
52
|
+
<NavItem link='#'
|
53
|
+
text='Contacts'
|
54
|
+
/>
|
55
|
+
</Nav>
|
56
|
+
</Drawer>
|
57
|
+
</div>
|
58
|
+
)
|
59
|
+
}
|
60
|
+
|
61
|
+
export default DrawerMenu
|
@@ -0,0 +1,24 @@
|
|
1
|
+
The Drawer component can be used to create responsive navigation menus and sidebars. It provides flexible options for controlling when and how the drawer appears based on screen size.
|
2
|
+
|
3
|
+
### Within Element
|
4
|
+
The `withinElement` prop allows you to render the drawer within its parent container:
|
5
|
+
- The drawer will be positioned relative to its parent element
|
6
|
+
- Useful for creating nested navigation structures
|
7
|
+
- This must be used in conjunction with the `triggerId` prop
|
8
|
+
|
9
|
+
This provides a clean way to create responsive navigation patterns that adapt to different screen sizes while maintaining a consistent user experience.
|
10
|
+
|
11
|
+
### Trigger Id
|
12
|
+
The `triggerId` prop allows you to connect an element to control the drawer:
|
13
|
+
- The specified element will toggle the drawer open/closed
|
14
|
+
- The element is automatically hidden when the drawer is opened via breakpoint
|
15
|
+
- The element reappears when the drawer is closed via breakpoint
|
16
|
+
|
17
|
+
### Breakpoint
|
18
|
+
Use the `breakpoint` prop to control when the drawer automatically opens or closes based on screen size. For example, setting `breakpoint="md"` will:
|
19
|
+
- Close the drawer on screens smaller than the medium breakpoint (992px)
|
20
|
+
- Automatically open the drawer on screens larger than or equal to the medium breakpoint
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= pb_rails("flex") do %>
|
2
|
+
<%= pb_rails("button", props: { text: "No Overlay Drawer", margin_right: "sm", data: {"open-drawer": "drawer-10"} }) %>
|
3
|
+
|
4
|
+
<%= pb_rails("drawer", props: {
|
5
|
+
id:"drawer-10",
|
6
|
+
overlay: false
|
7
|
+
}) do %>
|
8
|
+
Test me (No Overlay)
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
|
12
|
+
<%= pb_rails("button", props: { text: "Overlay Drawer", data: {"open-drawer": "drawer-11"} }) %>
|
13
|
+
|
14
|
+
<%= pb_rails("drawer", props: {
|
15
|
+
id:"drawer-11",
|
16
|
+
placement: "right"
|
17
|
+
}) do %>
|
18
|
+
Test me (Has Overlay)
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import React, { useState } from "react"
|
2
|
+
|
3
|
+
import Button from '../../pb_button/_button'
|
4
|
+
import Drawer from '../../pb_drawer/_drawer'
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
6
|
+
|
7
|
+
const DrawerSizes = () => {
|
8
|
+
// Individual state variables for each drawer size
|
9
|
+
const [openedNoOverlayDrawer, setOpenedNoOverlayDrawer] = useState(false)
|
10
|
+
const [openedOverlayDrawer, setOpenedOverlayDrawer] = useState(false)
|
11
|
+
|
12
|
+
// Toggle functions for each drawer
|
13
|
+
const toggleNoOverlayDrawer = () =>
|
14
|
+
setOpenedNoOverlayDrawer(!openedNoOverlayDrawer)
|
15
|
+
const toggleOverlayDrawer = () => setOpenedOverlayDrawer(!openedOverlayDrawer)
|
16
|
+
|
17
|
+
return (
|
18
|
+
<>
|
19
|
+
<Flex wrap>
|
20
|
+
<Button marginRight='md'
|
21
|
+
onClick={toggleNoOverlayDrawer}
|
22
|
+
>
|
23
|
+
No Overlay Drawer
|
24
|
+
</Button>
|
25
|
+
<Button marginRight='md'
|
26
|
+
onClick={toggleOverlayDrawer}
|
27
|
+
>
|
28
|
+
Overlay Drawer
|
29
|
+
</Button>
|
30
|
+
</Flex>
|
31
|
+
|
32
|
+
{/* Drawers for each size */}
|
33
|
+
<Drawer
|
34
|
+
onClose={toggleNoOverlayDrawer}
|
35
|
+
opened={openedNoOverlayDrawer}
|
36
|
+
overlay={false}
|
37
|
+
placement='right'
|
38
|
+
size='lg'
|
39
|
+
>
|
40
|
+
This is a Drawer with no overlay
|
41
|
+
</Drawer>
|
42
|
+
<Drawer
|
43
|
+
onClose={toggleOverlayDrawer}
|
44
|
+
opened={openedOverlayDrawer}
|
45
|
+
placement='right'
|
46
|
+
size='lg'
|
47
|
+
>
|
48
|
+
This is a Drawer with an overlay
|
49
|
+
</Drawer>
|
50
|
+
</>
|
51
|
+
)
|
52
|
+
}
|
53
|
+
|
54
|
+
export default DrawerSizes
|
@@ -0,0 +1 @@
|
|
1
|
+
Click the button to close the drawer when there is no overlay.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<%= pb_rails("flex") do %>
|
2
|
+
<%= pb_rails("button", props: { text: "XS Drawer", margin_right: "sm", data: {"open-drawer": "drawer-5"} }) %>
|
3
|
+
|
4
|
+
<%= pb_rails("drawer", props: {
|
5
|
+
id:"drawer-5",
|
6
|
+
size: "xs"
|
7
|
+
}) do %>
|
8
|
+
XS
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= pb_rails("button", props: { text: "SM Drawer", margin_right: "sm", data: {"open-drawer": "drawer-6"} }) %>
|
12
|
+
|
13
|
+
<%= pb_rails("drawer", props: {
|
14
|
+
id:"drawer-6",
|
15
|
+
size: "sm",
|
16
|
+
placement: "right"
|
17
|
+
}) do %>
|
18
|
+
This is a small drawer
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<%= pb_rails("button", props: { text: "MD Drawer", margin_right: "sm", data: {"open-drawer": "drawer-7"} }) %>
|
22
|
+
|
23
|
+
<%= pb_rails("drawer", props: {
|
24
|
+
id:"drawer-7",
|
25
|
+
size: "md"
|
26
|
+
}) do %>
|
27
|
+
This is a medium drawer
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<%= pb_rails("button", props: { text: "LG Drawer", margin_right: "sm", data: {"open-drawer": "drawer-8"} }) %>
|
31
|
+
|
32
|
+
<%= pb_rails("drawer", props: {
|
33
|
+
id:"drawer-8",
|
34
|
+
size: "lg",
|
35
|
+
placement: "right"
|
36
|
+
}) do %>
|
37
|
+
This is a large drawer
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<%= pb_rails("button", props: { text: "XL Drawer", margin_right: "sm", data: {"open-drawer": "drawer-9"} }) %>
|
41
|
+
|
42
|
+
<%= pb_rails("drawer", props: {
|
43
|
+
id:"drawer-9",
|
44
|
+
size: "xl"
|
45
|
+
}) do %>
|
46
|
+
This is an extra large drawer
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
49
|
+
|