-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display warnings on components (#9108)
Closes #8678 [Peek 2024-02-20 12-45.webm](https://github.com/enso-org/enso/assets/1428930/6bb6c4ad-5507-4b11-b2c9-b295bf10c745)
- Loading branch information
1 parent
9daca28
commit 6c4c791
Showing
3 changed files
with
75 additions
and
26 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 was deleted.
Oops, something went wrong.
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,44 @@ | ||
<script setup lang="ts"> | ||
/// types of messages | ||
export type GraphNodeMessageType = 'error' | 'warning' | ||
const props = defineProps<{ message: string; type: GraphNodeMessageType }>() | ||
function styleClassForType(type: GraphNodeMessageType) { | ||
switch (type) { | ||
case 'error': | ||
return 'GraphNodeError' | ||
case 'warning': | ||
return 'GraphNodeWarning' | ||
default: | ||
return '' | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="GraphNodeMessage" :class="styleClassForType(props.type)" v-text="props.message"></div> | ||
</template> | ||
|
||
<style scoped> | ||
.GraphNodeMessage { | ||
display: flex; | ||
height: 24px; | ||
padding: 1px 8px; | ||
align-items: flex-start; | ||
gap: 10px; | ||
font-weight: 800; | ||
white-space: nowrap; | ||
border-radius: var(--radius-full); | ||
color: var(--color-text-inversed); | ||
line-height: 20px; | ||
} | ||
.GraphNodeWarning { | ||
background-color: #faa212; | ||
} | ||
.GraphNodeError { | ||
background-color: #e85252; | ||
} | ||
</style> |