aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/newlightbox/Header
diff options
context:
space:
mode:
authorgeireann <geireann.lindfield@gmail.com>2023-06-06 14:36:21 -0400
committergeireann <geireann.lindfield@gmail.com>2023-06-06 14:36:21 -0400
commit3958654925e92b1046b3ed5d49160514b6e48258 (patch)
treedb02b6e74a03306be67b5e6071fa2272b1f7fc66 /src/client/views/newlightbox/Header
parent0fc47fefcb72592bd34e238949db9e98a84b8a63 (diff)
added rec stuff and begun updating components
Diffstat (limited to 'src/client/views/newlightbox/Header')
-rw-r--r--src/client/views/newlightbox/Header/LightboxHeader.scss90
-rw-r--r--src/client/views/newlightbox/Header/LightboxHeader.tsx67
-rw-r--r--src/client/views/newlightbox/Header/index.ts1
-rw-r--r--src/client/views/newlightbox/Header/utils.ts4
4 files changed, 162 insertions, 0 deletions
diff --git a/src/client/views/newlightbox/Header/LightboxHeader.scss b/src/client/views/newlightbox/Header/LightboxHeader.scss
new file mode 100644
index 000000000..2872a383b
--- /dev/null
+++ b/src/client/views/newlightbox/Header/LightboxHeader.scss
@@ -0,0 +1,90 @@
+@import '../NewLightboxStyles.scss';
+
+.newLightboxHeader-container {
+ width: 100%;
+ height: 100%;
+ background: $gray-l1;
+ border-radius: 20px 20px 0px 0px;
+ padding: 20px;
+ display: grid;
+ grid-template-columns: 70% 30%;
+ grid-template-rows: 50% 50%;
+
+ .title-container,
+ .type-container {
+ display: flex;
+ flex-direction: row;
+ gap: 5px;
+ justify-content: flex-start;
+ align-items: center;
+ }
+
+ .title-container {
+ grid-column: 1;
+ grid-row: 1;
+ }
+
+ .type-container {
+ grid-column: 1;
+ grid-row: 2;
+ .type {
+ padding: 2px 7px !important;
+ background: $gray-l2;
+ }
+ }
+
+ .lb-label {
+ color: $gray-l3;
+ font-weight: $h1-weight;
+ }
+
+ .lb-button {
+ border: solid 1.5px black;
+ padding: 3px 5px;
+ cursor: pointer;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-evenly;
+ align-items: center;
+ transition: 0.2s ease;
+ gap: 5px;
+ font-size: $body-size;
+ height: fit-content;
+
+ &:hover {
+ background: $gray-l2;
+ }
+
+ &.true {
+ background: $blue-l1;
+ }
+ }
+
+ .lb-button2 {
+ padding: 3px;
+ cursor: pointer;
+ display: flex;
+ flex-direction: row;
+ justify-content: space-evenly;
+ align-items: center;
+ transition: 0.2s ease;
+ gap: 5px;
+ font-size: 15px;
+ height: fit-content;
+ border-radius: 3px;
+
+ &:hover {
+ background: $gray-l2;
+ transform: scale(1.01);
+ }
+ }
+
+ &.dark {
+ background: $black;
+ }
+
+ &.light,
+ &.default {
+ background: $white;
+ }
+} \ No newline at end of file
diff --git a/src/client/views/newlightbox/Header/LightboxHeader.tsx b/src/client/views/newlightbox/Header/LightboxHeader.tsx
new file mode 100644
index 000000000..a542d2943
--- /dev/null
+++ b/src/client/views/newlightbox/Header/LightboxHeader.tsx
@@ -0,0 +1,67 @@
+import './LightboxHeader.scss';
+import * as React from 'react';
+import { INewLightboxHeader } from "./utils";
+import { NewLightboxView } from '../NewLightboxView';
+import { StrCast } from '../../../../fields/Types';
+import { EditableText } from '../components/EditableText';
+import { getType } from '../utils';
+import { Button, Size, Type } from 'browndash-components';
+import { MdExplore, MdTravelExplore } from 'react-icons/md'
+import { BsBookmark, BsBookmarkFill } from 'react-icons/bs'
+import { Doc } from '../../../../fields/Doc';
+
+
+export const NewLightboxHeader = (props: INewLightboxHeader) => {
+ const {height = 100, width} = props;
+ const [doc, setDoc] = React.useState<Doc | undefined>(NewLightboxView.LightboxDoc)
+ const [editing, setEditing] = React.useState<boolean>(false)
+ const [title, setTitle] = React.useState<JSX.Element | null>(
+ (null)
+ )
+ React.useEffect(() => {
+ let lbDoc = NewLightboxView.LightboxDoc
+ setDoc(lbDoc)
+ if (lbDoc) {
+ setTitle(
+ <EditableText
+ editing={editing}
+ text={StrCast(lbDoc.title)}
+ onEdit={(newText: string) => {
+ if(lbDoc) lbDoc.title = newText;
+ }}
+ setEditing={setEditing}
+ />)
+ }
+ }, [NewLightboxView.LightboxDoc])
+
+ const [saved, setSaved] = React.useState<boolean>(false)
+
+ if (!doc) return null
+ else return <div className={`newLightboxHeader-container`} onPointerDown={(e) => e.stopPropagation()} style={{ minHeight: height, height: height, width: width }}>
+ <div className={`title-container`}>
+ <div className={`lb-label`}>Title</div>
+ {title}
+ </div>
+ <div className={`type-container`}>
+ <div className={`lb-label`}>Type</div>
+ <div className={`type`}>{getType(StrCast(doc.type))}</div>
+ </div>
+ <div style={{gridColumn: 2, gridRow: 1, height: '100%', display: 'flex', justifyContent: 'flex-end', alignItems: 'center'}}>
+ <div className={`lb-button2`} onClick={() => setSaved(!saved)}>
+ {saved ? <BsBookmarkFill/> : <BsBookmark/>}
+ </div>
+ <div className={`lb-button2`} onClick={() => setSaved(!saved)}>
+ {saved ? <BsBookmarkFill/> : <BsBookmark/>}
+ </div>
+ </div>
+ <div style={{gridColumn: 2, gridRow: 2, height: '100%', display: 'flex', justifyContent: 'flex-end', alignItems: 'center'}}>
+ <div className={`lb-button ${NewLightboxView.ExploreMode}`} onClick={() => {
+ console.log(NewLightboxView.ExploreMode)
+ NewLightboxView.SetExploreMode(!NewLightboxView.ExploreMode)
+ }}>
+ <MdTravelExplore/>
+ t-SNE 2D Embeddings
+ </div>
+ </div>
+ </div>
+} \ No newline at end of file
diff --git a/src/client/views/newlightbox/Header/index.ts b/src/client/views/newlightbox/Header/index.ts
new file mode 100644
index 000000000..090677c16
--- /dev/null
+++ b/src/client/views/newlightbox/Header/index.ts
@@ -0,0 +1 @@
+export * from './LightboxHeader' \ No newline at end of file
diff --git a/src/client/views/newlightbox/Header/utils.ts b/src/client/views/newlightbox/Header/utils.ts
new file mode 100644
index 000000000..22e0487c2
--- /dev/null
+++ b/src/client/views/newlightbox/Header/utils.ts
@@ -0,0 +1,4 @@
+export interface INewLightboxHeader {
+ height?: number
+ width?: number
+} \ No newline at end of file