Skip to content
Snippets Groups Projects
Commit d7b1b347 authored by Jose Manuel Serrano Amaut's avatar Jose Manuel Serrano Amaut
Browse files

[FEAT]: Add darkmode demo in FileCard and Mosaic

parent 0dc44707
No related branches found
No related tags found
No related merge requests found
...@@ -55,7 +55,7 @@ const Demo${card?"FileCard":"FileMosaic"}DarkMode = () => { ...@@ -55,7 +55,7 @@ const Demo${card?"FileCard":"FileMosaic"}DarkMode = () => {
style={{ style={{
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
backgroundColor: "white", backgroundColor: "#121212",
padding: "25px 0", padding: "25px 0",
flexGrow:1 flexGrow:1
}} }}
......
import * as React from "react"; import * as React from "react";
import { ExtFile, FileCard, FileMosaic } from "../../../files-ui"; import {
ExtFile,
const sampleFileProps: ExtFile = { FileCard,
FileCardProps,
FileMosaic,
} from "../../../files-ui";
const sampleFileProps = {
id: "fileId", id: "fileId",
size: 28 * 1024 * 1024, size: 28 * 1024 * 1024,
type: "text/plain", type: "text/plain",
name: "file created from props.jsx", name: "sampleFile" + ".jsx",
valid: true, valid: true,
}; };
const sampleFilePropsCard = (elevationNumber: number): ExtFile => {
return {
id: "fileId",
size: 28 * 1024 * 1024,
type: "text/plain",
name: "elevation=" + elevationNumber + ".jsx",
valid: true,
};
};
const DemoFileMosaicDarkMode = (props: { card?: boolean }) => { const DemoFileMosaicDarkMode = (props: { card?: boolean }) => {
const removeFile = (id: string | number | undefined) => { const removeFile = (id: string | number | undefined) => {
console.log("delete button clicked on file: " + id); console.log("delete button clicked on file: " + id);
...@@ -19,23 +33,46 @@ const DemoFileMosaicDarkMode = (props: { card?: boolean }) => { ...@@ -19,23 +33,46 @@ const DemoFileMosaicDarkMode = (props: { card?: boolean }) => {
style={{ style={{
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
flexDirection: "column",
backgroundColor: "white", backgroundColor: "white",
alignItems: "center",
padding: "25px 0", padding: "25px 0",
flexGrow:1 flexGrow: 1,
gap: "7px",
}} }}
> >
<FileCard {...sampleFileProps} info onDelete={removeFile} /> {[0, 4, 16, 24].map((elevation) => (
<FileCard
key={elevation}
{...sampleFilePropsCard(elevation)}
onDelete={removeFile}
info
elevation={elevation as FileCardProps["elevation"]}
/>
))}
</div> </div>
<div <div
style={{ style={{
display: "flex", display: "flex",
flexDirection: "column",
justifyContent: "center", justifyContent: "center",
backgroundColor: "#121212", backgroundColor: "#121212",
alignItems: "center",
padding: "25px 0", padding: "25px 0",
flexGrow: 1, flexGrow: 1,
gap: "7px",
}} }}
> >
<FileCard {...sampleFileProps} info darkMode onDelete={removeFile} /> {[0, 4, 16, 24].map((elevation) => (
<FileCard
key={elevation}
{...sampleFilePropsCard(elevation)}
onDelete={removeFile}
darkMode
info
elevation={elevation as FileCardProps["elevation"]}
/>
))}
</div> </div>
</> </>
); );
...@@ -61,7 +98,6 @@ const DemoFileMosaicDarkMode = (props: { card?: boolean }) => { ...@@ -61,7 +98,6 @@ const DemoFileMosaicDarkMode = (props: { card?: boolean }) => {
backgroundColor: "#121212", backgroundColor: "#121212",
padding: "15px 0", padding: "15px 0",
flexGrow: 1, flexGrow: 1,
}} }}
> >
<FileMosaic {...sampleFileProps} info darkMode onDelete={removeFile} /> <FileMosaic {...sampleFileProps} info darkMode onDelete={removeFile} />
......
...@@ -210,84 +210,53 @@ const FileCardDemoPage = (props) => { ...@@ -210,84 +210,53 @@ const FileCardDemoPage = (props) => {
</section> </section>
<section id="dark-mode"> <section id="dark-mode">
<SubTitle content="Dark mode" /> <SubTitle content="Dark mode and Elevation" />
<DescParagraph> <DescParagraph>
The <CodeHighlight>FileCard</CodeHighlight> component supports dark The <CodeHighlight>FileCard</CodeHighlight> component supports dark
mode by setting the prop <TypeHighlight>darkMode</TypeHighlight> to{" "} mode by setting the prop <TypeHighlight>darkMode</TypeHighlight> to{" "}
<TypeHighlight>true</TypeHighlight>. <TypeHighlight>true</TypeHighlight>. The elevation can be used to
establish a hierarchy between other content. In practical terms, the
elevation controls the size of the shadow applied to the surface. In
dark mode, raising the elevation also makes the surface lighter.
</DescParagraph> </DescParagraph>
<div style={{ display: "flex", flexWrap: "wrap" }}> <div
style={{
display: "flex",
flexWrap: "wrap",
width: "100%",
padding: "25px 0",
}}
>
<DemoFileMosaicDarkMode card /> <DemoFileMosaicDarkMode card />
</div> </div>
<CodeJSFileMosaicDarkMode card /> <CodeJSFileMosaicDarkMode card />
</section> </section>
{/* <section id="localization"> {/* <section id="actions">
<SubTitle content="Localization" /> <SubTitle content="Actions: info, delete, see, watch, download" />
<DescParagraph> <DescParagraph>
The <CodeHighlight>FileMosaic</CodeHighlight> component has The <CodeHighlight>FileCard</CodeHighlight> component supports dark
multilanguage support. You can change the language in wich labels mode by setting the prop <TypeHighlight>darkMode</TypeHighlight> to{" "}
are displayed by setting the{" "} <TypeHighlight>true</TypeHighlight>. The elevation can be used to
<CodeHighlight>{"localization"}</CodeHighlight> prop. So far only establish a hierarchy between other content. In practical terms, the
the following languages are supported: elevation controls the size of the shadow applied to the surface. In
<ul> dark mode, raising the elevation also makes the surface lighter.
{[
"English",
"Spanish",
"French",
"Italian",
"Portuguese",
"Russian",
"Chinnese (simplified)",
"Chinnese (traditional)",
].map((x) => (
<li>
<TypeHighlight>{x}</TypeHighlight>
</li>
))}
</ul>
</DescParagraph> </DescParagraph>
<Paper <div
variant="outlined"
style={{ style={{
padding: "25px",
display: "flex", display: "flex",
alignItems: "center",
justifyContent: "center",
flexDirection: "column",
gap: "20px",
}}
>
<DemoFileMosaicLocalization />
</Paper>
<CodeJSFileMosaicLocalization />
</section>
<section id="file-icon">
<SubTitle content="File Icons (extensive list)" />
<DescParagraph>
The <CodeHighlight>FileMosaic</CodeHighlight> component supports
several file types to properly set a file icon. The complete list of
file icons is the following:
</DescParagraph>
<Paper
variant="outlined"
style={{
padding: "25px 0",
display: "flex",
alignItems: "center",
justifyContent: "center",
//flexDirection: "column",
gap: "10px",
flexWrap: "wrap", flexWrap: "wrap",
width: "100%",
padding: "25px 0",
}} }}
> >
<DemoFileMosaicFileIcons /> <DemoFileMosaicDarkMode card />
</Paper> </div>
</section> */}
<CodeJSFileMosaicDarkMode card />
</section> */}
<section id="api"> <section id="api">
<SubTitle content="API" /> <SubTitle content="API" />
<DescParagraph> <DescParagraph>
...@@ -356,7 +325,7 @@ const rightMenuItems = [ ...@@ -356,7 +325,7 @@ const rightMenuItems = [
}, },
{ {
id: 8, id: 8,
label: "Dark mode", label: "Dark mode & elevation",
referTo: "/components/file-mosaic#dark-mode", referTo: "/components/file-mosaic#dark-mode",
}, },
]; ];
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment