Skip to content

Commit 717f87d

Browse files
committed
styled the actions in snapshots, working on slider
1 parent e79c3c1 commit 717f87d

File tree

4 files changed

+118
-52
lines changed

4 files changed

+118
-52
lines changed

src/app/components/Actions/Action.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ const Action = (props: ActionProps): JSX.Element => {
8888
/>
8989
</div>
9090
{isCurrIndex ? (
91-
<button className='time-button' type='button'>
92-
Current
91+
<button className='current-snap' type='button'>
92+
{`Snapshot: ${displayName}`}
9393
</button>
9494
) : (
9595
<button className='time-button' type='button'>

src/app/components/Actions/RouteDescription.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const RouteDescription = (props: RouteProps): JSX.Element => {
1818
return (
1919
<div className='route-container'>
2020
<div className='route-header'>Route: {url.pathname}</div>
21-
<div className='route-content' style={{ height: `${actions.length * 30}px` }}>
22-
<div style={{ maxWidth: '50px' }}>
21+
<div className='route-content' style={{ height: `${actions.length * 42}px` }}>
22+
<div>
2323
<VerticalSlider className='main-slider' snapshots={actions} />
2424
</div>
2525
<div className='actions-container'>

src/app/components/TimeTravel/VerticalSlider.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const handle = (props: HandleProps): JSX.Element => {
2929

3030
function VerticalSlider(props: MainSliderProps): JSX.Element {
3131
const dispatch = useDispatch();
32-
const { snapshots} = props; // destructure props to get our total number of snapshots
32+
const { snapshots } = props; // destructure props to get our total number of snapshots
3333
const [sliderIndex, setSliderIndex] = useState(0); // create a local state 'sliderIndex' and set it to 0.
3434
const { tabs, currentTab }: MainState = useSelector((state: RootState) => state.main);
3535
const { currLocation } = tabs[currentTab]; // we destructure the currentTab object
@@ -39,27 +39,25 @@ function VerticalSlider(props: MainSliderProps): JSX.Element {
3939
// if we have a 'currLocation'
4040
let correctedSliderIndex;
4141

42-
for (let i = 0; i<snapshots.length; i++){
42+
for (let i = 0; i < snapshots.length; i++) {
4343
//@ts-ignore -- ignores the errors on the next line
44-
if (snapshots[i].props.index === currLocation.index){
44+
if (snapshots[i].props.index === currLocation.index) {
4545
correctedSliderIndex = i;
4646
}
4747
}
48-
setSliderIndex(correctedSliderIndex)
49-
48+
setSliderIndex(correctedSliderIndex);
5049
} else {
5150
setSliderIndex(0); // just set the thumb position to the beginning
5251
}
5352
}, [currLocation]); // if currLocation changes, rerun useEffect
54-
5553

5654
return (
5755
<Slider
5856
className='travel-slider'
5957
color='#0af548'
60-
vertical = 'true'
61-
reverse = 'true'
62-
height = '100%'
58+
vertical='true'
59+
reverse='true'
60+
height='100%'
6361
min={0} // index of our first snapshot
6462
max={snapshots.length - 1} // index of our last snapshot
6563
value={sliderIndex} // currently slider thumb position
Lines changed: 107 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,126 @@
1+
.route-container {
2+
width: 100%;
3+
}
4+
5+
.route-header {
6+
background-color: #1f2937;
7+
color: #ffffff;
8+
padding: 10px;
9+
font-size: 14px;
10+
}
11+
12+
.route-content {
13+
display: flex;
14+
flex-direction: row;
15+
margin-bottom: 50px;
16+
}
17+
18+
/* Container for individual action */
19+
.individual-action {
20+
margin: 0;
21+
padding: 0;
22+
}
23+
124
.action-component {
2-
padding: 3px 10px;
3-
display: grid;
4-
grid-template-columns: none;
25+
display: flex;
26+
padding: 6px 16px;
27+
background: white;
28+
border-bottom: 1px solid #e5e7eb;
29+
transition: background-color 200ms ease;
30+
}
31+
32+
.action-component:hover {
33+
background-color: #f9fafb;
34+
}
35+
36+
.action-component.selected {
37+
background-color: #f3f4f6;
38+
}
39+
40+
.action-component-trigger {
41+
width: 100%;
42+
display: flex;
43+
justify-content: space-between;
544
align-items: center;
6-
height: 24px;
7-
// background-color: $brand-color;
8-
// border-bottom-style: solid;
9-
// border-bottom-width: 1px;
10-
// background-color: none;
11-
// border-color: #292929;
12-
// border-color: $border-color;
13-
cursor: pointer;
14-
overflow: hidden;
15-
@extend %disable-highlight;
1645
}
1746

1847
.action-component-text {
19-
margin-bottom: 8px;
20-
color: $indiv-action-custom-text;
48+
flex: 1;
2149
}
2250

23-
.action-component.selected {
24-
//font-size: 16px;
25-
background-color: $indiv-action-selected;
26-
color: $indiv-action-selected-text;
51+
/* Input styling */
52+
.actionname {
53+
border: none;
54+
background: transparent;
55+
font-size: 1rem;
56+
color: #374151;
57+
width: 100%;
58+
padding: 2px 0;
59+
}
60+
61+
.actionname::placeholder {
62+
color: #6b7280;
2763
}
2864

29-
.action-component:focus {
65+
.actionname:focus {
3066
outline: none;
3167
}
3268

33-
.action-component-trigger {
34-
display: grid;
35-
grid-template-columns: 4fr 1fr;
36-
align-items: center;
37-
//height: 20px;
38-
cursor: pointer;
39-
overflow: hidden;
40-
@extend %disable-highlight;
69+
/* Button styling */
70+
.time-button,
71+
.jump-button,
72+
.current-location {
73+
min-width: 90px;
74+
padding: 4px 8px;
75+
border-radius: 6px;
76+
font-size: 0.9375rem;
77+
font-weight: 500;
78+
text-align: center;
79+
border: none;
80+
transition: all 200ms ease;
81+
margin-top: 6px;
4182
}
4283

43-
.route-container {
44-
width: 100%;
84+
.time-button {
85+
color: #6b7280;
86+
background: transparent;
4587
}
4688

47-
.route-header {
48-
background-color: #1f2937;
49-
color: #ffffff;
50-
padding: 10px;
51-
font-size: 14px;
89+
.jump-button {
90+
color: white;
91+
background: #111827;
5292
}
5393

54-
.route-content {
55-
display: flex;
56-
flex-direction: row;
57-
margin-bottom: 50px;
94+
.jump-button:hover {
95+
background: #374151;
96+
}
97+
98+
.current-location {
99+
color: #059669;
100+
background: #ecfdf5;
101+
}
102+
103+
/* Hide/show button transitions */
104+
.action-component:hover .time-button {
105+
display: none;
106+
}
107+
108+
.action-component:hover .jump-button {
109+
display: block;
110+
}
111+
112+
.jump-button {
113+
display: none;
114+
}
115+
116+
.current-snap {
117+
min-width: 90px;
118+
font-weight: bold;
119+
border: none;
120+
background: transparent;
121+
font-size: 1rem;
122+
color: #374151;
123+
width: 100%;
124+
padding: 2px 0;
125+
text-align: center;
58126
}

0 commit comments

Comments
 (0)