|
| 1 | +import React from "react"; |
| 2 | +import { navigate } from "gatsby"; |
| 3 | +import { useLocation } from "@reach/router"; |
| 4 | +import TabButton from "../../../../../reusecore/Button"; |
| 5 | +import { SistentLayout } from "../../sistent-layout"; |
| 6 | +import { SistentThemeProvider, Paper } from "@layer5/sistent"; |
| 7 | +import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; |
| 8 | +import { CodeBlock } from "../button/code-block"; |
| 9 | + |
| 10 | +const codes = [ |
| 11 | + `<SistentThemeProvider initialMode={isDark ? "dark" : "light"}> |
| 12 | + <Paper elevation={1} style={{ padding: "16px" }}> |
| 13 | + Default Paper with Elevation 1 |
| 14 | + </Paper> |
| 15 | + </SistentThemeProvider>`, |
| 16 | + `<SistentThemeProvider initialMode={isDark ? "dark" : "light"}> |
| 17 | + <Paper |
| 18 | + elevation={0} |
| 19 | + style={{ padding: "16px" }} |
| 20 | + > |
| 21 | + Elevation 0 (No shadow) |
| 22 | + </Paper> |
| 23 | + <Paper |
| 24 | + elevation={3} |
| 25 | + style={{ padding: "16px" }} |
| 26 | + > |
| 27 | + Elevation 3 |
| 28 | + </Paper> |
| 29 | + <Paper |
| 30 | + elevation={8} |
| 31 | + style={{ padding: "16px" }} |
| 32 | + > |
| 33 | + Elevation 8 |
| 34 | + </Paper> |
| 35 | + </SistentThemeProvider>`, |
| 36 | + `<SistentThemeProvider initialMode={isDark ? "dark" : "light"}> |
| 37 | + <Paper |
| 38 | + variant="elevation" |
| 39 | + style={{ padding: "16px" }} |
| 40 | + > |
| 41 | + Elevation Variant (Default) |
| 42 | + </Paper> |
| 43 | + <Paper |
| 44 | + variant="outlined" |
| 45 | + style={{ padding: "16px", borderColor: "#ccc" }} |
| 46 | + > |
| 47 | + Outlined Variant (No shadow) |
| 48 | + </Paper> |
| 49 | + </SistentThemeProvider>`, |
| 50 | + `<SistentThemeProvider initialMode={isDark ? "dark" : "light"}> |
| 51 | + <Paper |
| 52 | + square={false} |
| 53 | + style={{ padding: "16px" }} |
| 54 | + > |
| 55 | + Rounded Corners (Default) |
| 56 | + </Paper> |
| 57 | + <Paper square style={{ padding: "16px" }}> |
| 58 | + Square Corners |
| 59 | + </Paper> |
| 60 | + </SistentThemeProvider>`, |
| 61 | +]; |
| 62 | +const PaperCode = () => { |
| 63 | + const location = useLocation(); |
| 64 | + const { isDark } = useStyledDarkMode(); |
| 65 | + |
| 66 | + return ( |
| 67 | + <SistentLayout title="Paper"> |
| 68 | + <div className="content"> |
| 69 | + <a id="Identity"> |
| 70 | + <h2>Paper</h2> |
| 71 | + </a> |
| 72 | + <p> |
| 73 | + The Paper component provides an elevated surface for displaying |
| 74 | + content. It mimics the behavior of real-world surfaces with shadow |
| 75 | + effects, supporting Material Design's elevation system. |
| 76 | + </p> |
| 77 | + |
| 78 | + <div className="filterBtns"> |
| 79 | + <TabButton |
| 80 | + className={ |
| 81 | + location.pathname === "/projects/sistent/components/paper" |
| 82 | + ? "active" |
| 83 | + : "" |
| 84 | + } |
| 85 | + onClick={() => navigate("/projects/sistent/components/paper")} |
| 86 | + title="Overview" |
| 87 | + /> |
| 88 | + <TabButton |
| 89 | + className={ |
| 90 | + location.pathname === |
| 91 | + "/projects/sistent/components/paper/guidance" |
| 92 | + ? "active" |
| 93 | + : "" |
| 94 | + } |
| 95 | + onClick={() => |
| 96 | + navigate("/projects/sistent/components/paper/guidance") |
| 97 | + } |
| 98 | + title="Guidance" |
| 99 | + /> |
| 100 | + <TabButton |
| 101 | + className={ |
| 102 | + location.pathname === "/projects/sistent/components/paper/code" |
| 103 | + ? "active" |
| 104 | + : "" |
| 105 | + } |
| 106 | + onClick={() => navigate("/projects/sistent/components/paper/code")} |
| 107 | + title="Code" |
| 108 | + /> |
| 109 | + </div> |
| 110 | + <div className="main-content"> |
| 111 | + <a id="Basic Example"> |
| 112 | + <h3>Basic Example</h3> |
| 113 | + </a> |
| 114 | + <p> |
| 115 | + Here’s a simple example of a Paper component with default elevation. |
| 116 | + This creates a surface with a subtle shadow. |
| 117 | + </p> |
| 118 | + <div className="showcase"> |
| 119 | + <div className="items"> |
| 120 | + <SistentThemeProvider initialMode={isDark ? "dark" : "light"}> |
| 121 | + <Paper elevation={1} style={{ padding: "16px" }}> |
| 122 | + Default Paper with Elevation 1 |
| 123 | + </Paper> |
| 124 | + </SistentThemeProvider> |
| 125 | + </div> |
| 126 | + <CodeBlock name="basic-example" code={codes[0]} /> |
| 127 | + </div> |
| 128 | + |
| 129 | + <a id="Elevation Example"> |
| 130 | + <h3>Elevation Example</h3> |
| 131 | + </a> |
| 132 | + <p> |
| 133 | + The <code>elevation</code> prop controls the shadow depth. Use |
| 134 | + values from 0 to 24 to create varying levels of elevation: |
| 135 | + </p> |
| 136 | + <div className="showcase"> |
| 137 | + <div className="items"> |
| 138 | + <SistentThemeProvider initialMode={isDark ? "dark" : "light"}> |
| 139 | + <Paper elevation={0} style={{ padding: "16px" }}> |
| 140 | + Elevation 0 (No shadow) |
| 141 | + </Paper> |
| 142 | + <Paper elevation={3} style={{ padding: "16px" }}> |
| 143 | + Elevation 3 |
| 144 | + </Paper> |
| 145 | + <Paper elevation={8} style={{ padding: "16px" }}> |
| 146 | + Elevation 8 |
| 147 | + </Paper> |
| 148 | + </SistentThemeProvider> |
| 149 | + </div> |
| 150 | + <CodeBlock name="elevation-example" code={codes[1]} /> |
| 151 | + </div> |
| 152 | + <a id="Variant Example"> |
| 153 | + <h3>Variant Example</h3> |
| 154 | + </a> |
| 155 | + <p> |
| 156 | + The Paper component supports two variants: <code>elevation</code>{" "} |
| 157 | + (default) and <code>outlined</code>. The outlined variant removes |
| 158 | + shadows and adds a border instead: |
| 159 | + </p> |
| 160 | + <div className="showcase"> |
| 161 | + <div className="items"> |
| 162 | + <SistentThemeProvider initialMode={isDark ? "dark" : "light"}> |
| 163 | + <Paper variant="elevation" style={{ padding: "16px" }}> |
| 164 | + Elevation Variant (Default) |
| 165 | + </Paper> |
| 166 | + <Paper |
| 167 | + variant="outlined" |
| 168 | + style={{ padding: "16px", borderColor: "#ccc" }} |
| 169 | + > |
| 170 | + Outlined Variant (No shadow) |
| 171 | + </Paper> |
| 172 | + </SistentThemeProvider> |
| 173 | + </div> |
| 174 | + <CodeBlock name="variant-example" code={codes[2]} /> |
| 175 | + </div> |
| 176 | + |
| 177 | + <a id="Corners Example"> |
| 178 | + <h3>Square and Rounded Corners</h3> |
| 179 | + </a> |
| 180 | + <p> |
| 181 | + By default, the Paper component has rounded corners. You can make it |
| 182 | + square by setting the <code>square</code> prop to <code>true</code>. |
| 183 | + </p> |
| 184 | + <div className="showcase"> |
| 185 | + <div className="items"> |
| 186 | + <SistentThemeProvider initialMode={isDark ? "dark" : "light"}> |
| 187 | + <Paper square={false} style={{ padding: "16px" }}> |
| 188 | + Rounded Corners (Default) |
| 189 | + </Paper> |
| 190 | + <Paper square style={{ padding: "16px" }}> |
| 191 | + Square Corners |
| 192 | + </Paper> |
| 193 | + </SistentThemeProvider> |
| 194 | + </div> |
| 195 | + <CodeBlock name="corners-example" code={codes[3]} /> |
| 196 | + </div> |
| 197 | + </div> |
| 198 | + </div> |
| 199 | + </SistentLayout> |
| 200 | + ); |
| 201 | +}; |
| 202 | + |
| 203 | +export default PaperCode; |
0 commit comments