Skip to content

Commit

Permalink
fix(NcNoteCard): Adjust padding and margin
Browse files Browse the repository at this point in the history
Adjust the padding and margin to be a bit more condensed.
Also fixed the documentation as the text was incomplete.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Aug 2, 2024
1 parent 5fbed93 commit 8597acf
Showing 1 changed file with 37 additions and 19 deletions.
56 changes: 37 additions & 19 deletions src/components/NcNoteCard/NcNoteCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
This component is made to display additional information to the user. It is
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

When using an error type,
- **success**: Display a successful message.<br>
Should be used to show success of an operation or optional information to help a user be more successful.
- **info**: Display an informational message.<br>
Should be used to highlight information that users should take into account.
- **warning**: Display a warning to the user.<br>
Should be used for critical content demanding user attention due to potential risks.
- **error**: Display an error message.<br>
Should be used for negative potential consequences of an action.

```vue
<template>
Expand Down Expand Up @@ -63,13 +65,13 @@ When using an error type,
<component :is="icon"
class="notecard__icon"
:class="{'notecard__icon--heading': heading}"
:fill-color="color" />
:fill-color="color"
:size="20" />
</slot>
<div>
<h2 v-if="heading">
<p v-if="heading" class="notecard__heading">
{{ heading }}
</h2>
<slot />
</p>
</div>
</div>
</template>
Expand All @@ -85,17 +87,26 @@ export default {
props: {
/**
* Type of the attribute
* Type or severity of the message
*/
type: {
type: String,
default: 'warning',
validator: type => ['success', 'info', 'warning', 'error'].includes(type),
},
/**
* Enforce the `alert` role on the note card.
*
* The [`alert` role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role)
* should only be used for information that requires the user's immediate attention.
*/
showAlert: {
type: Boolean,
default: false,
},
/**
* Optional text to show as a heading of the note card
*/
heading: {
type: String,
default: '',
Expand Down Expand Up @@ -139,20 +150,27 @@ export default {

<style lang="scss" scoped>
.notecard {
--note-card-padding: calc(2 * var(--default-grid-baseline));
color: var(--color-main-text) !important;
background-color: var(--note-background) !important;
border-inline-start: 4px solid var(--note-theme);
border-inline-start: var(--default-grid-baseline) solid var(--note-theme);
border-radius: var(--border-radius);
margin: 1rem 0;
margin-top: 1rem;
padding: 1rem;
margin: 1lh 0;
padding: var(--note-card-padding);
display: flex;
flex-direction: row;
gap: 1rem;
gap: var(--note-card-padding);
&__heading {
font-weight: 600;
font-size: 20px; // Same as icon
}
&__icon--heading {
margin-bottom: auto;
margin-top: 0.3rem;
&__icon {
&--heading {
// 20px heading font size * 1.5 line height = 30px. 30px - 20px icon size = 10px. 10px / 2 for alignment
margin-block: 5px auto;
}
}
&--success {
Expand Down

0 comments on commit 8597acf

Please sign in to comment.