Skip to content

Commit 39e2055

Browse files
authored
Merge pull request #12 from oslabs-beta/45/historyV2_props_states
45/history v2 props states
2 parents 9bfbd47 + 1df3c0a commit 39e2055

File tree

13 files changed

+225
-363
lines changed

13 files changed

+225
-363
lines changed

src/app/components/Action.tsx

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface ActionProps {
2222
componentData: { actualDuration: number } | undefined;
2323
state?: Record<string, unknown>;
2424
viewIndex: number;
25+
isCurrIndex: boolean;
2526
handleOnkeyDown: (e: any, i: number) => any;
2627
logChangedState: (index: number) => any;
2728
}
@@ -53,6 +54,7 @@ const Action = (props: ActionProps): JSX.Element => {
5354
componentName,
5455
componentData,
5556
viewIndex,
57+
isCurrIndex,
5658
handleOnkeyDown,
5759
logChangedState,
5860
} = props;
@@ -98,43 +100,55 @@ const Action = (props: ActionProps): JSX.Element => {
98100
return (
99101
<div
100102
// Invoking keyboard functionality; functionality is in ActionContainer;
101-
onKeyDown={(e) => handleOnkeyDown(e, viewIndex)}
103+
onKeyDown={e => handleOnkeyDown(e, viewIndex)}
102104
className={
103105
selected || last ? 'action-component selected' : 'action-component'
104106
}
105107
onClick={() => {
106108
dispatch(changeView(index));
107109
}}
108-
role='presentation'
110+
role="presentation"
109111
style={index > sliderIndex ? { color: '#5f6369' } : {}}
110112
tabIndex={index}
111113
>
112114
<ReactHover options={optionsCursorTrueWithMargin}>
113-
<Trigger type='trigger'>
114-
<div className='action-component-trigger' style={index > sliderIndex ? { color: '#5f6369' } : {}}>
115-
<div className='action-component-text'>
115+
<Trigger type="trigger">
116+
<div className="action-component-trigger" style={index > sliderIndex ? { color: '#5f6369' } : {}}>
117+
<div className="action-component-text">
116118
{`${displayName}: ${componentName !== 'nameless' ? componentName : ''} `}
117119
{/* {`displayName: ${displayName}`} */}
118120
</div>
119-
<button className='time-button' type='button'>
121+
<button className="time-button" type="button">
120122
{displayTime}
121123
</button>
122-
<button
123-
className='jump-button'
124-
onClick={(e: any): void => {
125-
e.stopPropagation();
126-
dispatch(changeSlider(index));
127-
dispatch(changeView(index));
128-
}}
129-
tabIndex={index}
130-
type='button'
131-
>
132-
Jump
133-
</button>
124+
{
125+
isCurrIndex ? (
126+
<button
127+
className="current-location"
128+
type="button"
129+
>
130+
Current
131+
</button>
132+
)
133+
: (
134+
<button
135+
className="jump-button"
136+
onClick={(e: any): void => {
137+
e.stopPropagation();
138+
dispatch(changeSlider(index));
139+
dispatch(changeView(index));
140+
}}
141+
tabIndex={index}
142+
type="button"
143+
>
144+
Jump
145+
</button>
146+
)
147+
}
134148
</div>
135149
</Trigger>
136-
<Hover type='hover'>
137-
<div style={{ padding: '0.5rem 1rem' }} id='hover-box'>
150+
<Hover type="hover">
151+
<div style={{ padding: '0.5rem 1rem' }} id="hover-box">
138152
<p>{logChangedState(index)}</p>
139153
</div>
140154
</Hover>

0 commit comments

Comments
 (0)