Skip to content

feat: add toast notification component#9

Open
GautamKumarOffical wants to merge 2 commits into
kcolbchain:mainfrom
GautamKumarOffical:feat/toast-component
Open

feat: add toast notification component#9
GautamKumarOffical wants to merge 2 commits into
kcolbchain:mainfrom
GautamKumarOffical:feat/toast-component

Conversation

@GautamKumarOffical

Copy link
Copy Markdown

Summary

Adds a toast notification component with three variants to the brand design system.

Closes #7

What this PR does

Creates a toast notification component that:

  • Uses CSS variables from tokens.css for consistent styling
  • Supports three variants: success (green), warning (amber), error (red)
  • Auto-hides after configurable duration
  • Includes close button for manual dismissal
  • Uses smooth fade-in/fade-out animations

Files added

  • components/toast.css — Toast styles using design tokens
  • components/toast.js — Toast component logic

Usage

import { toastSuccess, toastWarning, toastError } from './components/toast.js';

toastSuccess('Operation completed!');
toastWarning('Please check your input');
toastError('Something went wrong');

Acceptance Criteria

  • Toast component using CSS variables from tokens.css
  • Three variants: success (green), warning (amber), error (red)
  • Auto-hide after configurable duration
  • Close button for manual dismissal
  • Smooth animations

Adds a toast notification component with three variants:
- success (green/ok)
- warning (amber/warn)
- error (red/hot)

Uses design tokens from tokens.css for consistent styling.

Closes kcolbchain#7
@abhicris

Copy link
Copy Markdown
Contributor

Welcome to kcolbchain, @GautamKumarOffical — glad you're here. 🌱

Here's what happens from this PR:

  1. Our automated review looks for obvious issues (tests, secrets, size) within a couple of hours.
  2. If it's clean and CI passes, we merge without back-and-forth.
  3. If we need changes, we'll leave a specific comment — not a generic nit. Push another commit and we re-review.

While you wait:

  • Run the repo's tests locally (see the repo README.md).
  • Keep the PR scoped to one concern — bigger PRs land slower.
  • Don't commit tokens or .env contents.

What happens after your first merge

Thanks for writing the code. We're building this to last.

@abhicris

Copy link
Copy Markdown
Contributor

🤖 Audit verdict: needs_human

Toast component uses innerHTML to render user-supplied message parameter, creating a potential XSS vector if not sanitized at call sites.

Risks flagged:

  • innerHTML with unsanitized user input (XSS risk)

Audited by the kcolbchain PR pipeline. See pipeline docs.

Replace innerHTML with textContent for the message parameter to
prevent potential XSS attacks from unsanitized user input. Use
proper DOM API (createElement, textContent, addEventListener)
instead of string interpolation with innerHTML.

Signed-off-by: Gautam Kumar <gautamkumarofficial@users.noreply.github.com>
@GautamKumarOffical

Copy link
Copy Markdown
Author

Fixed the XSS issue flagged by the audit. Replaced innerHTML with textContent for the message parameter and used proper DOM API (createElement, addEventListener) instead of string interpolation. No more unsanitized user input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

L0: Add a toast notification component to the design system

2 participants