npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@avicennatechnology/next-activity-indicator

v0.6.0

Published

Next.js için modern ve özelleştirilebilir aktivite göstergesi (loading spinner) bileşeni

Readme

Next.js Activity Indicator

Next.js projelerinde kullanılmak üzere tasarlanmış modern ve özelleştirilebilir aktivite göstergesi (loading spinner) bileşeni.

✨ Özellikler

  • 🎨 Özelleştirilebilir - Boyut ve renk seçenekleri
  • 🔧 TypeScript Desteği - Tam tip güvenliği
  • 🎯 Next.js Optimized - Next.js projelerine özel optimize edilmiş
  • 📱 Responsive - Tüm cihazlarda mükemmel görünüm
  • 🎭 CSS Modules - Stil çakışmalarını önler
  • Hafif - Minimal dosya boyutu

🚀 Kurulum

npm install @avicennatechnology/next-activity-indicator
yarn add @avicennatechnology/next-activity-indicator
pnpm add @avicennatechnology/next-activity-indicator

📖 Kullanım

Temel Kullanım

import { ActivityIndicator } from '@avicennatechnology/next-activity-indicator';

function MyComponent() {
  return (
    <div>
      <ActivityIndicator />
    </div>
  );
}

Boyut Seçenekleri

import { ActivityIndicator } from '@avicennatechnology/next-activity-indicator';

function MyComponent() {
  return (
    <div>
      <ActivityIndicator size="small" />
      <ActivityIndicator size="medium" />
      <ActivityIndicator size="large" />
    </div>
  );
}

Renk Özelleştirme

import { ActivityIndicator } from '@avicennatechnology/next-activity-indicator';

function MyComponent() {
  return (
    <div>
      <ActivityIndicator color="#3b82f6" />
      <ActivityIndicator color="#ef4444" />
      <ActivityIndicator color="#10b981" />
    </div>
  );
}

Loading State ile Kullanım

import { ActivityIndicator } from '@avicennatechnology/next-activity-indicator';
import { useState, useEffect } from 'react';

function DataComponent() {
  const [loading, setLoading] = useState(true);
  const [data, setData] = useState(null);

  useEffect(() => {
    fetchData().then(result => {
      setData(result);
      setLoading(false);
    });
  }, []);

  if (loading) {
    return (
      <div className="flex justify-center items-center h-64">
        <ActivityIndicator size="large" />
      </div>
    );
  }

  return <div>{/* Veri gösterimi */}</div>;
}

Next.js Sayfa Geçişleri

import { ActivityIndicator } from '@avicennatechnology/next-activity-indicator';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';

function Layout({ children }) {
  const router = useRouter();
  const [loading, setLoading] = useState(false);

  useEffect(() => {
    const handleStart = () => setLoading(true);
    const handleComplete = () => setLoading(false);

    router.events.on('routeChangeStart', handleStart);
    router.events.on('routeChangeComplete', handleComplete);
    router.events.on('routeChangeError', handleComplete);

    return () => {
      router.events.off('routeChangeStart', handleStart);
      router.events.off('routeChangeComplete', handleComplete);
      router.events.off('routeChangeError', handleComplete);
    };
  }, [router]);

  return (
    <div>
      {loading && (
        <div className="fixed inset-0 bg-white bg-opacity-75 flex items-center justify-center z-50">
          <ActivityIndicator size="large" />
        </div>
      )}
      {children}
    </div>
  );
}

API Çağrıları ile Kullanım

import { ActivityIndicator } from '@avicennatechnology/next-activity-indicator';
import { useState } from 'react';

function LoginForm() {
  const [isSubmitting, setIsSubmitting] = useState(false);

  const handleSubmit = async (e) => {
    e.preventDefault();
    setIsSubmitting(true);
    
    try {
      await loginUser(formData);
      // Başarılı giriş
    } catch (error) {
      // Hata yönetimi
    } finally {
      setIsSubmitting(false);
    }
  };

  return (
    <form onSubmit={handleSubmit}>
      {/* Form alanları */}
      <button type="submit" disabled={isSubmitting}>
        {isSubmitting ? (
          <ActivityIndicator size="small" color="#ffffff" />
        ) : (
          'Giriş Yap'
        )}
      </button>
    </form>
  );
}

🎛️ API Referansı

ActivityIndicator Props

| Prop | Tip | Varsayılan | Açıklama | |------|-----|-----------|----------| | size | "small" \| "medium" \| "large" | "medium" | Spinner'ın boyutu | | color | string | undefined | Spinner'ın rengi (CSS renk değeri) | | className | string | undefined | Ek CSS sınıfı | | style | React.CSSProperties | undefined | Inline stil | | ...props | HTMLAttributes<HTMLDivElement> | - | Tüm div özellikleri |

Boyut Seçenekleri

  • small: 0.8rem (12.8px)
  • medium: 1.2rem (19.2px)
  • large: 1.8rem (28.8px)

🎨 Özelleştirme

CSS Değişkenleri

Bileşen aşağıdaki CSS değişkenlerini kullanır:

.activity-indicator {
  --spinner-color: #71717a; /* Varsayılan renk */
  --spinner-size: 1.2rem;   /* Varsayılan boyut */
}

Özel Stiller

<ActivityIndicator 
  style={{ 
    '--spinner-color': '#3b82f6',
    '--spinner-size': '2rem'
  }}
/>

💡 Örnekler

Veri Yükleme

function ProductList() {
  const [products, setProducts] = useState([]);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    fetchProducts()
      .then(setProducts)
      .finally(() => setLoading(false));
  }, []);

  return (
    <div>
      {loading ? (
        <div className="text-center py-8">
          <ActivityIndicator size="large" />
          <p className="mt-4 text-gray-600">Ürünler yükleniyor...</p>
        </div>
      ) : (
        <div>
          {products.map(product => (
            <ProductCard key={product.id} product={product} />
          ))}
        </div>
      )}
    </div>
  );
}

Form Gönderimi

function ContactForm() {
  const [sending, setSending] = useState(false);
  const [message, setMessage] = useState('');

  const handleSubmit = async (e) => {
    e.preventDefault();
    setSending(true);
    
    try {
      await sendMessage(message);
      setMessage('');
      alert('Mesaj gönderildi!');
    } catch (error) {
      alert('Hata oluştu!');
    } finally {
      setSending(false);
    }
  };

  return (
    <form onSubmit={handleSubmit}>
      <textarea 
        value={message}
        onChange={(e) => setMessage(e.target.value)}
        placeholder="Mesajınızı yazın..."
        disabled={sending}
      />
      <button type="submit" disabled={sending}>
        {sending ? (
          <span className="flex items-center gap-2">
            <ActivityIndicator size="small" color="#ffffff" />
            Gönderiliyor...
          </span>
        ) : (
          'Gönder'
        )}
      </button>
    </form>
  );
}

Sayfa Geçiş Göstergesi

// _app.js
import { ActivityIndicator } from '@avicennatechnology/next-activity-indicator';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';

function MyApp({ Component, pageProps }) {
  const router = useRouter();
  const [loading, setLoading] = useState(false);

  useEffect(() => {
    const handleStart = () => setLoading(true);
    const handleComplete = () => setLoading(false);

    router.events.on('routeChangeStart', handleStart);
    router.events.on('routeChangeComplete', handleComplete);
    router.events.on('routeChangeError', handleComplete);

    return () => {
      router.events.off('routeChangeStart', handleStart);
      router.events.off('routeChangeComplete', handleComplete);
      router.events.off('routeChangeError', handleComplete);
    };
  }, [router]);

  return (
    <>
      {loading && (
        <div className="fixed inset-0 bg-white bg-opacity-80 flex items-center justify-center z-50">
          <ActivityIndicator size="large" />
        </div>
      )}
      <Component {...pageProps} />
    </>
  );
}

export default MyApp;

🛡️ TypeScript Desteği

Bu paket tam TypeScript desteği ile gelir:

import { ActivityIndicator, ActivityIndicatorProps } from '@avicennatechnology/next-activity-indicator';

const MySpinner: React.FC<ActivityIndicatorProps> = (props) => {
  return <ActivityIndicator {...props} />;
};

🎯 Avantajlar

  • Kolay Kullanım: Tek satırda ekleyebilirsiniz
  • Performans: Optimize edilmiş CSS animasyonları
  • Esneklik: Farklı boyut ve renk seçenekleri
  • Uyumluluk: Next.js ve React ile mükemmel uyum
  • Tip Güvenliği: Full TypeScript desteği
  • Responsive: Tüm cihazlarda mükemmel görünüm

📦 Build & Yayın

# Build
npm run build

# Yayın
npm publish

🤝 Katkıda Bulunma

  1. Bu repository'yi fork edin
  2. Feature branch'i oluşturun (git checkout -b feature/amazing-feature)
  3. Değişikliklerinizi commit edin (git commit -m 'Add amazing feature')
  4. Branch'inizi push edin (git push origin feature/amazing-feature)
  5. Pull Request açın

📄 Lisans

MIT License - Detaylar için LICENSE dosyasına bakın.

🆘 Destek

Herhangi bir sorunuz veya öneriniz varsa:


Bu paket Next.js projelerinde loading state'lerini yönetmeyi kolaylaştırmak için tasarlanmıştır. ⚡