Skip to content

Commit b7d7188

Browse files
committed
feat: make left and right panels stack vertically on small screens for better responsiveness
1 parent 42972ff commit b7d7188

File tree

2 files changed

+38
-39
lines changed

2 files changed

+38
-39
lines changed

src/components/DatasetDetailPage/LoadDatasetTabs.tsx

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ import cpp from "react-syntax-highlighter/dist/esm/languages/hljs/cpp";
99
import javascript from "react-syntax-highlighter/dist/esm/languages/hljs/javascript";
1010
import matlab from "react-syntax-highlighter/dist/esm/languages/hljs/matlab";
1111
import python from "react-syntax-highlighter/dist/esm/languages/hljs/python";
12-
import {
13-
docco,
14-
atomOneDark,
15-
} from "react-syntax-highlighter/dist/esm/styles/hljs";
16-
import { Color } from "three";
12+
import { atomOneDark } from "react-syntax-highlighter/dist/esm/styles/hljs";
1713

18-
// Register them
14+
// import { Color } from "three";
15+
16+
// Register language theme
1917
SyntaxHighlighter.registerLanguage("python", python);
2018
SyntaxHighlighter.registerLanguage("bash", bash);
2119
SyntaxHighlighter.registerLanguage("cpp", cpp);
@@ -101,31 +99,12 @@ const LoadDatasetTabs: React.FC<LoadDatasetTabsProps> = ({
10199
);
102100
};
103101

104-
// const CopyableCodeBlock = ({ code }: { code: string }) => {
105-
// const handleCopy = () => {
106-
// navigator.clipboard.writeText(code);
107-
// };
108-
// return (
109-
// <Box sx={{ position: "relative" }}>
110-
// <IconButton
111-
// onClick={handleCopy}
112-
// size="small"
113-
// sx={{ position: "absolute", top: 5, right: 5 }}
114-
// >
115-
// <Tooltip title="Copy to clipboard">
116-
// <ContentCopyIcon fontSize="small" />
117-
// </Tooltip>
118-
// </IconButton>
119-
// <code style={flashcardStyles.codeBlock}>{code}</code>
120-
// </Box>
121-
// );
122-
// };
123102
const CopyableCodeBlock = ({
124103
code,
125-
language = "python", // optionally allow language selection
104+
language = "python",
126105
}: {
127106
code: string;
128-
language?: string;
107+
language?: string; // optional prop
129108
}) => {
130109
const handleCopy = () => {
131110
navigator.clipboard.writeText(code);

src/pages/DatasetDetailPage.tsx

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,14 @@ const DatasetDetailPage: React.FC = () => {
733733
gap: 2,
734734
alignItems: "flex-start",
735735
marginTop: 2,
736-
height: "960px", // fixed height container
737-
// border: "2px solid red",
736+
flexDirection: {
737+
xs: "column",
738+
md: "row",
739+
},
740+
height: {
741+
xs: "auto",
742+
md: "960px", // fixed height container
743+
},
738744
}}
739745
>
740746
{/* ✅ JSON Viewer (left panel) */}
@@ -745,8 +751,18 @@ const DatasetDetailPage: React.FC = () => {
745751
padding: 2,
746752
borderRadius: "8px",
747753
overflowX: "auto",
748-
height: "100%",
749-
// border: "2px solid yellow",
754+
height: {
755+
xs: "auto",
756+
md: "100%",
757+
},
758+
width: {
759+
xs: "100%",
760+
md: "auto",
761+
},
762+
minWidth: {
763+
xs: "100%",
764+
md: "350px",
765+
},
750766
}}
751767
>
752768
<ReactJson
@@ -763,22 +779,28 @@ const DatasetDetailPage: React.FC = () => {
763779
{/* ✅ Data panels (right panel) */}
764780
<Box
765781
sx={{
766-
width: "460px",
767-
minWidth: "360px",
782+
width: {
783+
xs: "100%",
784+
md: "460px",
785+
},
786+
minWidth: {
787+
xs: "100%",
788+
md: "360px",
789+
},
790+
height: {
791+
xs: "auto",
792+
md: "100%",
793+
},
768794
display: "flex",
769795
flexDirection: "column",
770796
gap: 2,
771-
height: "100%",
772-
// border: "2px solid green",
773797
}}
774798
>
775799
<Box
776800
sx={{
777801
backgroundColor: Colors.lightBlue,
778802
padding: 2,
779803
borderRadius: "8px",
780-
// marginTop: 4,
781-
// border: "2px solid orange",
782804
flex: 1,
783805
// overflowY: "auto",
784806
}}
@@ -884,10 +906,8 @@ const DatasetDetailPage: React.FC = () => {
884906
backgroundColor: "#eaeaea",
885907
padding: 2,
886908
borderRadius: "8px",
887-
// marginTop: 4,
888909
flex: 1,
889910
// overflowY: "auto",
890-
// border: "2px solid blue",
891911
}}
892912
>
893913
{/* ✅ Header with toggle */}

0 commit comments

Comments
 (0)