Skip to content

Instantly share code, notes, and snippets.

View zeing's full-sized avatar
💭
ZEING 0.0.2

Witthawin Sirisiwaphak zeing

💭
ZEING 0.0.2
View GitHub Profile
sequenceDiagram
  Front ->>+ Saleor: Mutation paymentGatewayInitialize,<br>amount, list of<br>payment gateways IDs<br>to initialize and <br>data, if<br>old ID provided, return<br>error
  Saleor ->>+ PaymentApp: payment-gateway-initialize-session<br>webhook
  PaymentApp ->>+ PaymentProvider: Initialize payment gateway
  PaymentProvider -->>- PaymentApp: Data mandatory to<br>initialize the payment<br>on fronted
  PaymentApp -->>- Saleor: PaymentGateway data with config
  Saleor -->>- Front: List of PaymentGateway data and configs
  Front ->>+ Saleor: TransactionInitialize<br> with amount and<br>payment gateway ID, data
  Saleor ->> Saleor: Create TransactionItem
{"title":"Colors","description":":purple_square: - Purple\n:blue_square: - Blue\n:green_square: - Green\n:yellow_square: - Yellow\n:orange_square: - Orange\n:red_square: - Red","color":2105893}
@zeing
zeing / colors.json
Last active September 5, 2021 16:46
Discord
{"title":"Colors","description":":purple_square: - Purple\n:blue_square: - Blue\n:green_square: - Green\n:yellow_square: - Yellow\n:orange_square: - Orange\n:red_square: - Red","color":2105893}
@zeing
zeing / Dialog.js
Created July 11, 2021 11:47
Tailwindcss Component
import { Dialog, Transition } from '@headlessui/react'
import { Fragment, useState, useRef } from 'react'
import classnames from 'classnames'
const Modal = ({
isOpen = false,
onClose,
size = undefined,
title,
titleClassName,
hideCloseIcon = false,
@zeing
zeing / _app.js
Last active July 1, 2021 13:34
API
import api from 'api.js'
function MyApp({ Component, pageProps, router: { route } }) {
const naviMonitor = (response) => {
console.log('monitor', response)
if (!response.ok) {
const error = new Error(response.data?.message)
error.status = response.data?.code
import Providers from 'next-auth/providers'
import NextAuth from 'next-auth'
const api = new RestClient()
import { RestClient } from 'lib/api'
import { differenceInDays } from 'date-fns'
const checkExpiredTime = (expired_time) => {
const dt = new Date(expired_time)
const now = new Date()
if (differenceInDays(dt, now) <= 10) {
@zeing
zeing / Tab.js
Created May 1, 2021 06:55
Tab Tailwindcss + React
import classnames from 'classnames'
const Tab = ({ menus, value, onChange }) => {
return (
<nav className="flex justify-between sm:justify-start mx-auto container bg-white shadow-md">
{menus.map((menu, index) => (
<button
onClick={() => onChange?.(menu)}
disabled={menu?.disabled}
key={index}
@zeing
zeing / Breadcrumb.js
Last active September 4, 2025 02:34
Breadcrumb Tailwindcss + React
import classnames from 'classnames'
const Breadcrumb = ({ contents = [] }) => {
return (
<nav className="text-black font-bold" aria-label="Breadcrumb">
<ol className="list-none p-0 inline-flex">
{contents.map((content, index) => {
return index == contents.length - 1 ? (
<li className="flex items-center" key={index}>
<a href={content.url} className="text-gray-400">