This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var version=function(){"use strict";return(t=new Date,e="month")=>{let n=new Date(t.getFullYear(),t.getMonth(),"month"===e?1:t.getDate());const a="month"===e?42:7,o=[];for(let e=0;e<a;e++){if(0===e){const t=n.getDay();n.setDate(n.getDate()-t)}else n.setDate(n.getDate()+1);let a={isCurrentMonth:n.getMonth()===t.getMonth(),date:new Date(n),year:n.getYear(),month:n.getMonth(),day:n.getDate(),isToday:n===t,events:[]};o.push(a)}return o}}(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function ProgressBar() { | |
| return ( | |
| <div className='w-full'> | |
| <div className='h-1.5 w-full bg-pink-100 overflow-hidden'> | |
| <div className='animate-progress w-full h-full bg-pink-500 origin-left-right'></div> | |
| </div> | |
| </div> | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use client'; | |
| /* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */ | |
| import * as React from 'react'; | |
| export default function useControlled({ controlled, default: defaultProp, name, state = 'value' }) { | |
| // isControlled is ignored in the hook dependency lists as it should never change. | |
| const { current: isControlled } = React.useRef(controlled !== undefined); | |
| const [valueState, setValue] = React.useState(defaultProp); | |
| const value = isControlled ? controlled : valueState; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use client'; | |
| import useControlled from './useControlled'; | |
| export default function usePagination(props = {}) { | |
| // keep default values in sync with @default tags in Pagination.propTypes | |
| const { | |
| boundaryCount = 1, | |
| componentName = 'usePagination', | |
| count = 1, | |
| defaultPage = 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useMemo } from 'react'; | |
| import dayjs from 'dayjs'; | |
| import weekday from 'dayjs/plugin/weekday'; | |
| dayjs.extend(weekday); | |
| export default function useCalendar(date = new Date(), range = 'month') { | |
| const dates = useMemo(() => { | |
| let startDate = range === 'month' ? dayjs(date).startOf('month') : dayjs(date); | |
| let days = range === 'month' ? 42 : 7; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const date = new Date(2024, 03, 25); | |
| console.log(date.toLocaleString()); | |
| const range = 'month'; | |
| /** using native date **/ | |
| const generateDates = (date, range = 'month', splitIntoWeeks = true) => { | |
| // the first day of the month | |
| let startDate = new Date( | |
| date.getFullYear(), | |
| date.getMonth(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState, useEffect } from 'react'; | |
| import styled from 'styled-components' | |
| const { datesGenerator } = require('dates-generator'); | |
| const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
| const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] | |
| const Container = styled.div` | |
| width: 300px; | |
| border: 1px solid black; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Bank extends Model | |
| { | |
| use Encryptable; | |
| protected $encryptable = [ | |
| 'account_number', | |
| ]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const range = (start, end) => { | |
| const length = end - start; | |
| return Array.from({ length }, (_, i) => start + i); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useEffect, useState, useRef } from 'react'; | |
| const useCountdown = (targetDate) => { | |
| const countDownDate = new Date(targetDate).getTime(); | |
| const [countDown, setCountDown] = useState( | |
| countDownDate - new Date().getTime() | |
| ); | |
| const timerRef = useRef(null); |