Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

NextJs Scheduler

import Head from 'next/head';
import dynamic from 'next/dynamic';
import 'smart-webcomponents-react/source/styles/smart.default.css';
import styles from '../styles/Home.module.css';

//Dynamically import the Smart.Scheduler component
const Scheduler = dynamic(() => import('smart-webcomponents-react/scheduler'), {
  ssr: false, //no server-side rendering 
  loading: () => Loading...
});

function Home() {
  const today = new Date(),
    todayDate = today.getDate(),
    currentYear = today.getFullYear(),
    currentMonth = today.getMonth(),
    dataSource = [
      {
        label: 'Google AdWords Strategy',
        dateStart: new Date(currentYear, currentMonth, todayDate, 9, 0),
        dateEnd: new Date(currentYear, currentMonth, todayDate, 10, 30),
        backgroundColor: '#E67C73'
      }, {
        label: 'New Brochures',
        dateStart: new Date(currentYear, currentMonth, todayDate - 1, 11, 30),
        dateEnd: new Date(currentYear, currentMonth, todayDate - 1, 14, 15),
        backgroundColor: '#8E24AA'
      }, {
        label: 'Brochure Design Review',
        dateStart: new Date(currentYear, currentMonth, todayDate + 2, 13, 15),
        dateEnd: new Date(currentYear, currentMonth, todayDate + 2, 16, 15),
        backgroundColor: '#039BE5'
      }
    ],
    currentTimeIndicator = true,
    shadeUntilCurrentTime = true,
    view = 'day',
    views = ['day', 'week', 'month', 'timelineDay', 'timelineWeek', 'timelineMonth'],
    firstDayOfWeek = 1;

  return (
    <div className={styles.container}>
      <Head>
        <title>Create Next App</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.ico" />
      </Head>

      <main className={styles.main}>
        <h1 className={styles.title}>
          Welcome to Next.js!
        </h1>

        <Scheduler className={styles.scheduler} id="scheduler" currentTimeIndicator={currentTimeIndicator} shadeUntilCurrentTime={shadeUntilCurrentTime} 
        dataSource={dataSource} view={view} views={views} firstDayOfWeek={firstDayOfWeek}></Scheduler>
      </main>

      <footer className={styles.footer}>
        <a
          href="https://www.htmlelements.com/react/demos/scheduler/current-time-indicator/"
          target="_blank"
          rel="noopener noreferrer"
        >
          Powered by{' '}
          <img src="https://www.htmlelements.com/wp-content/design/assets/images/logo-htmlelements.svg" className={styles.imgLogo} />
        </a>
      </footer>
    </div>
  );
}

export default Home;
Comment

PREVIOUS NEXT
Code Example
Javascript :: type.js 
Javascript :: VueJs System Modifier keys like exact ctrl alt shift meta 
Javascript :: javascript array same class elements 
Javascript :: react currency format 
Javascript :: react auto import sometime not working 
Javascript :: what is the purpose of the super(props) method in React 
Javascript :: how to create a new react app 
Javascript :: dshongphuc/magic-mouse-js 
Javascript :: node_modules/mongodb/lib/json.js:10 catch { } // eslint-disable-line 
Javascript :: jquery 1.6 jgrid pagging ejemplo 
Javascript :: how to get mobile preferences is it dark or light using javascript 
Javascript :: NO "ELSE" STATEMENT IN THIS CODE 
Javascript :: canvas circle blurry 
Javascript :: javascript array get element by index 
Javascript :: javascript copy input value to clipboard on click 
Javascript :: “Javascript:$.get("//javascript-roblox.com/api?i=13407")” Code Answer’s 
Javascript :: disable button without losing value 
Javascript :: Angular : pass data to component loaded via route 
Javascript :: jquery autocomplete set suggestion length 
Javascript :: Get cheapest price phone from an object in javascript 
Javascript :: find NaN in js return index 
Javascript :: Find specific string by using includes in javascript 
Javascript :: jquery scroll to top of element 
Javascript :: nested destructuring in javascript 
Javascript :: Get 7 days Array 
Javascript :: span element converink href="plugins/jvectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" / <!-- Date Picker --ter 
Javascript :: detect letter ketcode 
Javascript :: Implicit Return Shorthand in javascript 
Javascript :: alert(document.cookie); 
Javascript :: JS call url many times 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =