chore: css pointer and hover
This commit is contained in:
@ -70,7 +70,7 @@ const flattenProjectHelper = (
|
|||||||
...f,
|
...f,
|
||||||
parentPath,
|
parentPath,
|
||||||
level,
|
level,
|
||||||
index
|
index,
|
||||||
}
|
}
|
||||||
// keep track of the file once within the recursive list that will be built up
|
// keep track of the file once within the recursive list that will be built up
|
||||||
list.push(content)
|
list.push(content)
|
||||||
@ -117,7 +117,7 @@ const flattenProject = (
|
|||||||
|
|
||||||
const insertFakeRowAtFirstPositionUnderParentAfterFolder = (
|
const insertFakeRowAtFirstPositionUnderParentAfterFolder = (
|
||||||
fileExplorerEntries: FileExplorerEntry[],
|
fileExplorerEntries: FileExplorerEntry[],
|
||||||
fakeRow: {entry: FileExplorerEntry | null, isFile: boolean} | null
|
fakeRow: { entry: FileExplorerEntry | null; isFile: boolean } | null
|
||||||
): void => {
|
): void => {
|
||||||
if (!fakeRow) {
|
if (!fakeRow) {
|
||||||
// no op
|
// no op
|
||||||
@ -130,8 +130,6 @@ const insertFakeRowAtFirstPositionUnderParentAfterFolder = (
|
|||||||
// ...fakeRow,
|
// ...fakeRow,
|
||||||
// }
|
// }
|
||||||
// fileExplorerEntries.splice(insertIndex, 0, requestedEntry)
|
// fileExplorerEntries.splice(insertIndex, 0, requestedEntry)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,9 +150,9 @@ export const FileExplorer = ({
|
|||||||
}: {
|
}: {
|
||||||
parentProject: Project
|
parentProject: Project
|
||||||
openedRows: { [key: string]: boolean }
|
openedRows: { [key: string]: boolean }
|
||||||
selectedRow: FileEntry | null
|
selectedRow: FileExplorerEntry | null
|
||||||
onRowClickCallback: (file: FileExplorerEntry) => void
|
onRowClickCallback: (file: FileExplorerEntry) => void
|
||||||
fakeRow: {entry: FileExplorerEntry | null, isFile: boolean} | null
|
fakeRow: { entry: FileExplorerEntry | null; isFile: boolean } | null
|
||||||
}) => {
|
}) => {
|
||||||
// Wrap the FileEntry in a FileExplorerEntry to keep track for more metadata
|
// Wrap the FileEntry in a FileExplorerEntry to keep track for more metadata
|
||||||
let flattenedData: FileExplorerEntry[] = []
|
let flattenedData: FileExplorerEntry[] = []
|
||||||
@ -247,11 +245,11 @@ export const FileExplorerRow = ({
|
|||||||
selectedRow,
|
selectedRow,
|
||||||
}: {
|
}: {
|
||||||
row: FileExplorerRow
|
row: FileExplorerRow
|
||||||
selectedRow: FileExplorerEntry
|
selectedRow: FileExplorerEntry | null
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`h-6 flex flex-row items-center text-xs ${row.name === selectedRow?.name && row.parentPath === selectedRow?.parentPath ? 'bg-red-200' : ''}`}
|
className={`h-6 flex flex-row items-center text-xs cursor-pointer hover:bg-sky-400 ${row.name === selectedRow?.name && row.parentPath === selectedRow?.parentPath ? 'bg-sky-800' : ''}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
row.rowClicked()
|
row.rowClicked()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -31,7 +31,10 @@ export const ProjectExplorer = ({
|
|||||||
|
|
||||||
// fake row is used for new files or folders
|
// fake row is used for new files or folders
|
||||||
// you should not be able to have multiple fake rows for creation
|
// you should not be able to have multiple fake rows for creation
|
||||||
const [fakeRow, setFakeRow] = useState<{entry: FileExplorerEntry | null, isFile: boolean} | null>(null)
|
const [fakeRow, setFakeRow] = useState<{
|
||||||
|
entry: FileExplorerEntry | null
|
||||||
|
isFile: boolean
|
||||||
|
} | null>(null)
|
||||||
|
|
||||||
const onRowClickCallback = (file: FileExplorerEntry) => {
|
const onRowClickCallback = (file: FileExplorerEntry) => {
|
||||||
const newOpenedRows = { ...openedRows }
|
const newOpenedRows = { ...openedRows }
|
||||||
@ -42,7 +45,6 @@ export const ProjectExplorer = ({
|
|||||||
const value = openedRows[key]
|
const value = openedRows[key]
|
||||||
newOpenedRows[key] = !value
|
newOpenedRows[key] = !value
|
||||||
setOpenedRows(newOpenedRows)
|
setOpenedRows(newOpenedRows)
|
||||||
console.log(file)
|
|
||||||
setSelectedRow(file)
|
setSelectedRow(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user