-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f4bbca
commit 24a7a9b
Showing
8 changed files
with
81 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
packages/@sanity/desk-tool/src/panes/documentPane/HistoryTimeline.tsx
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
...es/@sanity/desk-tool/src/panes/documentPane/historyTimelinePanel/historyTimelinePanel.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.root { | ||
/* display: block; */ | ||
overflow: auto; | ||
} | ||
|
||
.header { | ||
padding: 1em; | ||
font-weight: 700; | ||
} | ||
|
||
.item { | ||
padding: 1em; | ||
|
||
@nest &:hover { | ||
background: rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
@nest &[data-selected='true'] { | ||
background: #06f; | ||
color: #fff; | ||
} | ||
} | ||
|
||
.item__typeName { | ||
/* display: block; */ | ||
} | ||
|
||
.item__timestamp { | ||
font-size: 13px; | ||
line-height: 16px; | ||
} |
43 changes: 43 additions & 0 deletions
43
...es/@sanity/desk-tool/src/panes/documentPane/historyTimelinePanel/historyTimelinePanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react' | ||
import {format} from 'date-fns' | ||
import {Timeline, TimeRef} from '../history/timeline' | ||
|
||
import styles from './historyTimelinePanel.css' | ||
|
||
interface HistoryTimelinePanelProps { | ||
timeline: Timeline | ||
onSelect: (id: string) => void | ||
startTimeId?: string | ||
} | ||
|
||
export function HistoryTimelinePanel(props: HistoryTimelinePanelProps) { | ||
const {timeline, onSelect} = props | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<div className={styles.header}>Timeline</div> | ||
|
||
{timeline.mapChunks((chunk, idx) => { | ||
const startTimeId = timeline.createTimeId(idx, chunk) | ||
const isSelected = props.startTimeId === startTimeId | ||
|
||
return ( | ||
<div | ||
className={styles.item} | ||
data-selected={isSelected} | ||
key={chunk.id} | ||
title={chunk.id} | ||
onClick={evt => { | ||
evt.preventDefault() | ||
evt.stopPropagation() | ||
onSelect(startTimeId) | ||
}} | ||
> | ||
<div className={styles.item__typeName}>{chunk.type}</div> | ||
<div className={styles.item__timestamp}>{format(chunk.startTimestamp)}</div> | ||
</div> | ||
) | ||
})} | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
packages/@sanity/desk-tool/src/panes/documentPane/historyTimelinePanel/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './historyTimelinePanel' |
35 changes: 0 additions & 35 deletions
35
packages/@sanity/desk-tool/src/panes/documentPane/timelinePane/TimelinePane.css
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
packages/@sanity/desk-tool/src/panes/documentPane/timelinePane/TimelinePane.txt
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/@sanity/desk-tool/src/panes/documentPane/timelinePane/index.txt
This file was deleted.
Oops, something went wrong.