-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(diff fashion): added ability to see inline/side by side diff
- Loading branch information
1 parent
52a0f39
commit cc196e3
Showing
6 changed files
with
134 additions
and
29 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
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,53 @@ | ||
<template> | ||
<button | ||
class="inline-flex items-center justify-center px-1 py-1 text-sm text-gray-600 transition-transform transform bg-gray-300 border border-gray-800 rounded-sm dark:border-gray-400 dark:text-white dark:bg-gray-800 align-center focus-visible:ring-4 active:scale-y-75" | ||
role="button" | ||
:aria-label="label" | ||
:title="label" | ||
@click="handleClick" | ||
> | ||
<span | ||
aria-live="assertive" | ||
role="status" | ||
:class="{ | ||
'inline-block transition-transform bg-gray-100': true, | ||
'rotate-90': sideBySide, | ||
}" | ||
> | ||
<DiffStyle class="w-6 h-6" /> | ||
</span> | ||
</button> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue' | ||
import DiffStyle from '~/components/icons/diffStyle.vue' | ||
export default Vue.extend({ | ||
components: { DiffStyle }, | ||
props: { | ||
clickHandler: { | ||
type: Function, | ||
required: true, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
sideBySide: true, | ||
} | ||
}, | ||
computed: { | ||
label() { | ||
if (this.sideBySide) { | ||
return 'Switch unified diff layout' | ||
} | ||
return 'Switch to split diff layout' | ||
}, | ||
}, | ||
methods: { | ||
handleClick() { | ||
this.sideBySide = !this.sideBySide | ||
this.clickHandler(this.sideBySide === true) | ||
}, | ||
}, | ||
}) | ||
</script> |
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,26 @@ | ||
<template> | ||
<svg | ||
id="Layer_1" | ||
viewBox="0 0 122.742 122.881" | ||
enable-background="new 0 0 122.742 122.881" | ||
stroke="currentColor" | ||
:class="className" | ||
> | ||
<g> | ||
<path | ||
d="M5.709,23.974h47.709V5.691c0-1.581,0.643-3.015,1.679-4.05C56.108,0.629,57.492,0,59,0h58.163 c1.508,0,2.891,0.628,3.902,1.641c1.035,1.036,1.678,2.469,1.678,4.05v87.524c0,1.582-0.643,3.016-1.678,4.051 c-1.012,1.012-2.395,1.641-3.902,1.641H69.453v18.283c0,1.582-0.645,3.016-1.68,4.051c-1.012,1.012-2.395,1.641-3.902,1.641H5.709 c-1.509,0-2.891-0.629-3.903-1.641c-1.036-1.035-1.679-2.469-1.679-4.051V74.389C0.044,74.082,0,73.76,0,73.428 c0-0.334,0.044-0.656,0.127-0.963V29.666c0-1.582,0.643-3.016,1.679-4.051C2.818,24.603,4.2,23.974,5.709,23.974L5.709,23.974z M94.113,29.137c1.395-1.468,3.717-1.525,5.184-0.129c1.469,1.396,1.525,3.718,0.129,5.185L88.514,45.609h27.131V7.319H60.517 v16.655h3.354c1.508,0,2.891,0.628,3.902,1.641c1.035,1.035,1.68,2.469,1.68,4.051v61.922h46.191V52.963h-27.15l10.932,11.476 c1.396,1.469,1.34,3.789-0.129,5.186c-1.467,1.396-3.789,1.338-5.184-0.129L77.27,51.815c-1.34-1.407-1.354-3.634,0-5.057 L94.113,29.137L94.113,29.137z M22.943,58.333c-1.396-1.468-1.338-3.789,0.129-5.185c1.468-1.396,3.789-1.338,5.185,0.129 L45.1,70.898c1.354,1.424,1.34,3.65-0.001,5.057L28.257,93.637c-1.396,1.467-3.717,1.525-5.185,0.129 c-1.467-1.395-1.525-3.717-0.129-5.184l10.932-11.479H7.227v38.459h55.127v-84.27H7.227V69.75h26.628L22.943,58.333L22.943,58.333z" | ||
/> | ||
</g> | ||
</svg> | ||
</template> | ||
<script lang="ts"> | ||
import Vue from 'vue' | ||
export default Vue.extend({ | ||
props: { | ||
className: { | ||
type: String, | ||
required: false, | ||
}, | ||
}, | ||
}) | ||
</script> |
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
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
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