Skip to content

Commit

Permalink
Improve UX by marking changed lines
Browse files Browse the repository at this point in the history
  • Loading branch information
daadaadaah committed Feb 7, 2021
1 parent 651dd00 commit dcb1014
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ function getLine(line, i, { styles }) {
);
}

function getStyleWithMark(styles) {
return styles.map((item) => {
if(item.opacity && item.opacity === 1) {
item.borderLeft = "2px solid rgb(255 190 0 / 71%)";
item.paddingLeft = "6px";
}
return item
})
}

function Slide({ lines, styles, changes }) {
return (
<pre
Expand Down Expand Up @@ -64,5 +74,6 @@ function Slide({ lines, styles, changes }) {
export default function SlideWrapper({ time, version }) {
const { lines, changes } = version;
const styles = animation((time + 1) / 2, lines);
return <Slide lines={lines} styles={styles} changes={changes} />;
const stylesWithMarke = getStyleWithMark(styles);
return <Slide lines={lines} styles={stylesWithMarke} changes={changes} />;
}

0 comments on commit dcb1014

Please sign in to comment.