-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #835 from posit-dev/dotnomad/config-diff-style
Style ConfigSettings diff with DiffTag component
- Loading branch information
Showing
2 changed files
with
97 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!-- Copyright (C) 2023 by Posit Software, PBC. --> | ||
|
||
<template> | ||
<span | ||
class="diff text-weight-medium" | ||
:class="diffType === 'inserted' ? 'diff-inserted' : 'diff-removed'" | ||
> | ||
<span class="diff-marker">{{ marker }}</span>{{ value }} | ||
</span> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { PropType, computed } from 'vue'; | ||
|
||
export type DiffType = 'inserted' | 'removed'; | ||
|
||
const props = defineProps({ | ||
diffType: { | ||
type: Object as PropType<DiffType>, | ||
required: true, | ||
}, | ||
value: { | ||
type: [String, Boolean, Number], | ||
required: true | ||
} | ||
}); | ||
|
||
const marker = computed(() => { | ||
return props.diffType === 'inserted' ? '+' : '-'; | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.diff { | ||
display: inline-flex; | ||
align-items: center; | ||
border-radius: 8px; | ||
position: relative; | ||
border: 1px solid; | ||
padding-left: 8px; | ||
padding-right: 8px; | ||
column-gap: 6px; | ||
line-height: 1.75; | ||
|
||
&.diff-removed { | ||
border-color: red; | ||
|
||
.diff-marker { | ||
border-color: red; | ||
} | ||
} | ||
|
||
&.diff-inserted { | ||
border-color: green; | ||
|
||
.diff-marker { | ||
border-color: green; | ||
} | ||
} | ||
|
||
.diff-marker { | ||
display: flex; | ||
align-self: stretch; | ||
align-items: center; | ||
border-right: 1px solid; | ||
padding-right: 6px; | ||
} | ||
} | ||
</style> |
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