Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info NoteCard #4063

Merged
merged 1 commit into from May 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/components/NcNoteCard/NcNoteCard.vue
Expand Up @@ -20,9 +20,10 @@

<docs>
This component is made to display additional information to the user. It is
available in three versions:
available in four versions:

- success: Display a successful message
- info: Display an informational message
- warning: Display a warning to the user. This indicate that the action they want
- error: Display an error message. For example

Expand All @@ -41,6 +42,10 @@ When using an error type,
<NcNoteCard type="success">
<p>You won</p>
</NcNoteCard>

<NcNoteCard type="info">
<p>For your information</p>
</NcNoteCard>
</div>
```
</docs>
Expand All @@ -66,6 +71,7 @@ When using an error type,
import CheckboxMarkedCircle from 'vue-material-design-icons/CheckboxMarkedCircle.vue'
import AlertDecagram from 'vue-material-design-icons/AlertDecagram.vue'
import Alert from 'vue-material-design-icons/Alert.vue'
import Information from 'vue-material-design-icons/Information.vue'

export default {
name: 'NcNoteCard',
Expand All @@ -77,7 +83,7 @@ export default {
type: {
type: String,
default: 'warning',
validator: type => ['success', 'warning', 'error'].includes(type),
validator: type => ['success', 'info', 'warning', 'error'].includes(type),
},
showAlert: {
type: Boolean,
Expand All @@ -98,6 +104,8 @@ export default {
return AlertDecagram
case 'success':
return CheckboxMarkedCircle
case 'info':
return Information
case 'warning':
return Alert
default:
Expand All @@ -110,6 +118,8 @@ export default {
return 'var(--color-error)'
case 'success':
return 'var(--color-success)'
case 'info':
return 'var(--color-info)'
moan0s marked this conversation as resolved.
Show resolved Hide resolved
case 'warning':
return 'var(--color-warning)'
default:
Expand Down Expand Up @@ -143,6 +153,11 @@ export default {
--note-theme: var(--color-success);
}

&--info {
--note-background: rgba(var(--color-info-rgb), 0.1);
--note-theme: var(--color-info);
moan0s marked this conversation as resolved.
Show resolved Hide resolved
}

&--error {
--note-background: rgba(var(--color-error-rgb), 0.1);
--note-theme: var(--color-error);
Expand Down