react-feather#Moon JavaScript Examples

The following examples show how to use react-feather#Moon. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: miniheader.js    From about-1hive with GNU General Public License v3.0 5 votes vote down vote up
Header = props => {
  const node = useRef()
  const [darkMode, toggleDarkMode] = useDarkMode()

  const button = useRef()
  const [isMenuOpen, updateIsMenuOpen] = useState(false)

  const isMobile = useMediaQuery('(max-width: 960px)')

  return (
    <StyledHeader open={isMenuOpen}>
      <Row>
        <StyledNavTitleWrapper>
          <StyledHomeLink
            to="/"
            style={{
              textDecoration: `none`
            }}
          >
            <StyledUni />
          </StyledHomeLink>
          {props.path && props.path !== '/' && props.path !== '' && (
            <>
              <StyledNavTitle to={'/' + props.path.split('/')[1]}>
                {props.path.length > 20 ? 'Docs /' : '1hive Docs /'}
              </StyledNavTitle>
              <StyledNavTitle to={'/docs/' + props.path.split('/')[2]}>
                {props.path.split('/')[2].replace(/(^|\s)\S/g, function(t) {
                  return t.toUpperCase()
                })}
              </StyledNavTitle>
              <StyledNavTitle to={'/docs/' + props.path.split('/')[2] + '/' + props.path.split('/')[3]}>
                {props.path.split('/')[3] &&
                  '/ ' +
                    props.path
                      .split('/')[3]
                      .replace(/\d+-/g, '')
                      .replace(/-/g, ' ')
                      .replace(/(^|\s)\S/g, function(t) {
                        return t.toUpperCase()
                      })}
              </StyledNavTitle>{' '}
            </>
          )}
        </StyledNavTitleWrapper>
        <MenuToggle ref={button} open={isMenuOpen} onClick={() => updateIsMenuOpen(!isMenuOpen)}>
          {isMenuOpen ? <StyledCloseIcon /> : <StyledMenuIcon />}
        </MenuToggle>
        <StyledNav ref={node} open={isMenuOpen}>
          {!isMobile && <Search {...props} />}
          {isMobile }
          <StyledButton type="button" onClick={toggleDarkMode}>
            {darkMode ? <Sun size={20} /> : <Moon size={20} />}
          </StyledButton>
          <StyledButton fill>
            <a href="https://discord.gg/NTDBRNz">
              <Discord />
            </a>
          </StyledButton>
          <StyledButton fill>
            <a href="https://github.com/1hive">
              <Github width={20} />
            </a>
          </StyledButton>
          <StyledButton type="button">
            <Link to="/">
              <Home size={20} />{' '}
            </Link>
          </StyledButton>
        </StyledNav>
      </Row>
      <MobileSearchWrapper>
        <Search {...props} />
      </MobileSearchWrapper>
    </StyledHeader>
  )
}
Example #2
Source File: Header.js    From dashboard with MIT License 5 votes vote down vote up
function Header() {
  const { mode, toggleMode } = useContext(WindmillContext);
  const { toggleSidebar } = useContext(SidebarContext);
  const history = useHistory();

  return (
    <header className="z-40 py-2 h-12 dark:bg-gray-800 bg-white shadow-md overflow-hidden">
      <div className="flex justify-between px-2 dark:text-primary-400 text-primary-500">
        <div className="flex flex-shrink-0 justify-between">
          <button
            type="button"
            className="focus:shadow-outline-primary mr-2 p-1 rounded-md focus:outline-none md:mr-6"
            onClick={toggleSidebar}
            aria-label="Menu"
          >
            <Menu className="w-5 h-5" aria-hidden="true" />
          </button>

          <button
            type="button"
            aria-label="Care Dashboard"
            className="hidden mr-1 md:block"
            onClick={() => {
              history.push("/");
            }}
          >
            <span className="flex text-2xl subpixel-antialiased font-black leading-none">
              Care Dashboard
            </span>
          </button>
        </div>
        <div className="item-center flex flex-shrink-0 justify-between space-x-6">
          <div className="flex items-center">
            <svg
              xmlns="http://www.w3.org/2000/svg"
              viewBox="0 0 714 173"
              className="h-6"
              aria-hidden="true"
            >
              <use fill="#fff" />
              <use fill="#b21936" />
              <path
                d="M703.5 73.1a51.46 51.46 0 00-10.6-18.6c-4.8-5.3-10.6-9.6-17.2-12.6-7-3.1-14.6-4.7-22.3-4.6-4.4 0-8.7.4-13 1.3l.7-7.4c.6-9.9-5.7-18.9-15.2-21.7-3.2-.9-6.4-1.6-9.7-2-3.2-.4-6.5-.5-9.7-.5-6.4 0-12.8 1-18.8 3.2-6.1 2.2-11.8 5.6-16.5 10-4.9 4.7-8.7 10.4-11.1 16.7l-1.2 3.4c-1.8.7-3.6 1.6-5.2 2.8-7.7-3.8-16.7-5.8-27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43.98 43.98 0 003.2.1c.8 0 1.9 0 3.4-.1 1.6-.1 3.2-.2 4.8-.5 9.5-1.6 16.7-9.3 17.7-18.8.4.6.9 1.2 1.4 1.8 4.7 6 10.7 10.8 17.6 14 14.8 6.6 31.8 6.6 46.6 0 3.4-1.6 6.5-3.6 9.5-5.9 3.3 4.8 8.3 8 14 8.9 1.6.3 3.3.4 4.9.5l3.2.1c.7 0 1.9 0 3.4-.1 1.6-.1 3.2-.2 4.8-.5 7-1.2 13-5.8 15.9-12.3 2.9 6.5 8.9 11.1 15.9 12.3 1.6.3 3.3.4 4.9.5a43.98 43.98 0 003.2.1c.8 0 1.9 0 3.4-.1 1.6-.1 3.2-.2 4.8-.5 4-.7 7.8-2.5 10.8-5.3 8.2 4.8 18.2 7.2 30 7.2 5.5 0 11-.4 16.4-1.2 5.2-.7 9.5-1.4 13.2-2.2 1.4-.3 2.8-.7 4.1-1.3a85.31 85.31 0 005.4 1.8c2.3.6 4.6 1.2 6.9 1.6 2.6.5 5.2.8 7.8 1 2.4.2 5 .3 7.8.3a63.52 63.52 0 0019.9-2.9 52.74 52.74 0 0015-7.5c.5.4 1.1.8 1.6 1.2 5.4 3.7 11.6 6.2 18 7.5 5.8 1.2 11.7 1.8 17.6 1.7 6.8.1 13.5-.6 20.1-1.8a133.78 133.78 0 0014.2-3.5c.3-.1.7-.2 1-.4 2.7 1.9 5.7 3.2 9 3.8 4.5.7 9 1.1 13.5 1.1s9-.4 13.4-1.1c6.5-1.1 12.1-5.1 15.2-10.9 4.5 3.6 9.5 6.6 14.9 8.6 8 3 16.6 4.4 25.2 4.3 11.1.1 22.1-1.8 32.5-5.7 8.4-3.2 13.9-11.5 13.6-20.5-.1-4.4-.8-8.8-1.9-13a21.67 21.67 0 005.1-10.4c.4-2.1.6-4.1.8-6.2a81.93 81.93 0 00.3-7c-.1-7-1.2-13.9-3.4-20.5z"
                fill="#fff"
              />
              <path
                d="M656.4 157.2c-8.7.1-17.3-1.3-25.5-4.3-5.1-2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 11.8 1.6.2 3.2.4 4.8.5a43.98 43.98 0 003.2.1c.7 0 1.9 0 3.3-.1 1.6-.1 3.1-.2 4.6-.5 3.9-.6 7.5-2.4 10.4-5.1l.5-.4.6.3c8.1 4.7 18 7.1 29.5 7.1 5.4 0 10.9-.4 16.3-1.2 5.1-.7 9.5-1.4 13.2-2.2 1.3-.3 2.7-.7 3.9-1.2l.3-.1.3.1c2.1.8 3.9 1.3 5.4 1.8 2.3.6 4.5 1.2 6.9 1.6 2.5.5 5.1.8 7.7 1 2.4.2 5 .3 7.8.3 6.7.1 13.3-.9 19.6-2.9 5.3-1.7 10.3-4.2 14.8-7.4l.5-.4.5.4 1.6 1.2c5.3 3.6 11.3 6.1 17.7 7.4 5.7 1.2 11.6 1.7 17.4 1.7 6.7.1 13.4-.6 20-1.8 4.7-.9 9.4-2.1 14.1-3.5l.8-.3.7-.2.4.3c2.5 1.8 5.5 3.1 8.6 3.6a79.18 79.18 0 0026.6 0c6.2-1 11.6-4.9 14.6-10.4l.4-1.2z"
                fill="#b21936"
              />
              <path d="M78 124.3c.6 1.2 1 2.5 1.3 3.8l.9 4a53.44 53.44 0 01-8.1 2.1c-3.3.6-6.6.9-10 .9-11.8 0-20.8-3.2-26.9-9.7s-9.2-15.8-9.3-28.1c0-5.1.7-10.1 2.3-14.9 1.4-4.4 3.7-8.5 6.7-12s6.8-6.2 11-8c4.8-2 10-3 15.2-2.9 3.4 0 6.9.2 10.3.8 2.6.4 5.2 1 7.7 1.8a19.31 19.31 0 01-.5 4.2c-.2 1.3-.6 2.6-1.1 3.8-2.3-.8-4.7-1.3-7.1-1.7-3.1-.5-6.2-.7-9.3-.7-3.8-.1-7.6.7-11.1 2.2-3.1 1.4-5.8 3.5-7.9 6.2-2.2 2.8-3.8 5.9-4.7 9.3-1.1 3.9-1.6 7.9-1.6 11.9 0 10.2 2.4 17.7 7.3 22.4s11.4 7.1 19.7 7.1c2.7 0 5.4-.2 8.1-.7 2.5-.4 4.8-1 7.1-1.8z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8 14.1 3.8a53.33 53.33 0 009.8-.9c3.3-.6 6.5-1.5 9.5-2.6 1.1 2.2 2 4.4 2.7 6.8.8 2.8 1.2 5.6 1.3 8.5-8 2.9-16.4 4.4-24.9 4.2-5.9.1-11.9-.8-17.5-2.8-4.5-1.7-8.6-4.4-11.9-7.9-3.1-3.4-5.4-7.5-6.8-11.9-3-9.9-2.9-20.4.1-30.3a35.97 35.97 0 016.7-12.3c3-3.5 6.8-6.3 11-8.3 4.8-2.1 10.1-3.1 15.3-3 4.7-.1 9.3.8 13.7 2.6 3.8 1.7 7.3 4.2 10.1 7.4s5 7 6.3 11.1c1.4 4.5 2.2 9.1 2.1 13.8l-.2 5.3-.5 4.2h-46.8zm28.7-14c-.2-4.5-1.4-8.2-3.8-11-2.3-2.8-5.5-4.2-9.7-4.2-4.7 0-8.3 1.3-10.8 4s-3.9 6.4-4.4 11.2h28.7z" />
              <defs>
                <path
                  id="coronaSafeLogo_svg__B"
                  d="M707.2 84.4c-2.1-6.9-5.6-13.3-10.3-18.8-4.7-5.4-10.5-9.8-17-12.8-7-3.2-14.6-4.9-22.2-5-4.4-.1-8.8.3-13.1 1.1l.8-7.4c.8-9.9-5.4-19-14.9-21.9-3.1-1-6.4-1.7-9.6-2.2-3.2-.4-6.4-.6-9.7-.7-6.4-.2-12.8.8-18.9 2.8-6.2 2.1-11.9 5.4-16.7 9.8-5 4.6-8.9 10.2-11.4 16.5l-1.2 3.3a23.29 23.29 0 00-5.2 2.7c-7.7-4-16.6-6.1-26.9-6.3-10.5-.1-21 1.5-31 4.7-.2.1-.4.1-.5.2-.2-.1-.4-.2-.6-.2-4.6-1.8-9.3-3.1-14.1-4.1s-9.7-1.5-14.7-1.5c-13.7-.2-25.2 3.1-34.3 10-.8.6-1.6 1.2-2.3 1.9l-.1-.1c-8.3-7.8-19.9-11.8-34.4-12.1-4.7-.1-9.4.2-14.1.8-4.2.5-8.3 1.3-12.3 2.5s-7.6 3.5-10.3 6.6c-6.1-5.6-15.5-10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1 13.1-5.5 16.1-12 2.8 6.6 8.7 11.3 15.7 12.6 1.6.3 3.3.5 4.9.6a43.98 43.98 0 003.2.1h3.4c1.6 0 3.2-.2 4.8-.4 4.1-.6 7.9-2.4 10.9-5.2 8.1 4.9 18.1 7.6 29.9 7.8 5.5.1 11-.2 16.4-.9a195.27 195.27 0 0013.3-2c1.4-.3 2.8-.7 4.1-1.2l5.4 1.9c2.3.7 4.6 1.2 6.9 1.7 2.6.5 5.2.9 7.8 1.1 2.4.2 5 .4 7.8.4 6.8.2 13.5-.7 20-2.6 5.4-1.6 10.5-4 15.1-7.2.5.4 1 .8 1.6 1.2 5.4 3.8 11.4 6.4 17.8 7.8 5.8 1.3 11.7 1.9 17.6 2 6.8.2 13.5-.3 20.2-1.5 4.8-.8 9.6-1.9 14.3-3.3.3-.1.7-.2 1-.3 2.6 2 5.7 3.3 8.9 3.9 8.9 1.7 18 1.8 26.9.5 6.5-1 12.2-4.9 15.4-10.6 4.4 3.7 9.4 6.7 14.7 8.9 8 3.1 16.5 4.7 25.1 4.7 11.1.3 22.1-1.4 32.6-5.1 8.5-3.1 14.1-11.2 14-20.2-.1-4.4-.6-8.7-1.7-13 2.7-2.9 4.5-6.5 5.3-10.4.3-1.7.6-3.8.9-6.2.2-2.3.4-4.7.4-7-.4-7.2-1.3-14.1-3.3-20.8z"
                />
              </defs>
            </svg>
          </div>
          <button
            type="button"
            className="focus:shadow-outline-primary p-1 rounded-md focus:outline-none"
            onClick={toggleMode}
            aria-label="Toggle color mode"
          >
            {mode === "dark" ? (
              <Sun className="w-5 h-5" aria-hidden="true" />
            ) : (
              <Moon className="w-5 h-5" aria-hidden="true" />
            )}
          </button>
        </div>
      </div>
    </header>
  );
}
Example #3
Source File: Navbar.js    From covid19india-react with MIT License 5 votes vote down vote up
SunMoon = ({darkMode}) => {
  return (
    <div className="SunMoon" onClick={darkMode.toggle}>
      <div>{darkMode.value ? <Sun color={'#ffc107'} /> : <Moon />}</div>
    </div>
  );
}
Example #4
Source File: header.js    From about-1hive with GNU General Public License v3.0 4 votes vote down vote up
Header = props => {
  const matches = useMediaQuery('only screen and (max-width: 1024px)')
  const node = useRef()
  const button = useRef()
  const [isMenuOpen, updateIsMenuOpen] = useState(false)
  const [darkMode, toggleDarkMode] = useDarkMode()

  const data = useStaticQuery(graphql`
    {
      site {
        siteMetadata {
          menulinks {
            name
            sublinks {
              description
              name
              link
            }
          }
          title
        }
      }
    }
  `)

  useLayoutEffect(() => {
    // Get original body overflow
    const originalStyle = window.getComputedStyle(document.body).overflow
    // Prevent scrolling on mount
    if (isMenuOpen) {
      document.body.style.overflow = 'hidden'
      document.body.style.maxHeight = '-webkit-fill-available'
    }
    // Re-enable scrolling when component unmounts
    return () => (document.body.style.overflow = originalStyle)
  }, [isMenuOpen]) // Empty array ensures effect is only run on mount and unmount

  useEffect(() => {
    const handleClickOutside = e => {
      if (node.current.contains(e.target) || button.current.contains(e.target)) {
        return
      }
      updateIsMenuOpen(false)
    }

    document.addEventListener('mousedown', handleClickOutside)

    return () => {
      document.removeEventListener('mousedown', handleClickOutside)
    }
  }, [isMenuOpen, updateIsMenuOpen, matches])

  return (
    <StyledHeader open={isMenuOpen}>
      <StyledNavTitleWrapper>
        <StyledHomeLink
          to="/"
          style={{
            textDecoration: `none`
          }}
        >
          <StyledUni />

          <StyledWordmark />
        </StyledHomeLink>
        {props.path && props.path !== '/' && props.path !== '' && (
          <>
            <StyledNavTitle to={'/' + props.path.split('/')[1]}>/ {props.path.split('/')[1]}</StyledNavTitle>
          </>
        )}
      </StyledNavTitleWrapper>
      <MenuToggle ref={button} open={isMenuOpen} onClick={() => updateIsMenuOpen(!isMenuOpen)}>
        {isMenuOpen ? <StyledCloseIcon /> : <StyledMenuIcon />}
      </MenuToggle>
      <StyledNav ref={node} open={isMenuOpen}>
        {data.site.siteMetadata.menulinks
          .filter(item => {
            return item.name !== 'Community'
          })
          .map(item => {
            return <Menu key={item.name} data={item} />
          })}
        <StyledButton type="button" onClick={toggleDarkMode}>
          {darkMode ? <Sun size={20} /> : <Moon size={20} />}
        </StyledButton>
        {props.path !== undefined && <StyledTradeLink href="https://gardens.1hive.org/#/xdai/garden/0x8ccbeab14b5ac4a431fffc39f4bec4089020a155">Open Garden</StyledTradeLink>}
      </StyledNav>
    </StyledHeader>
  )
}
Example #5
Source File: Navbar.js    From webDevsCom with MIT License 4 votes vote down vote up
Navbar = () => {
  const themeContext = useContext(ThemeContext);
  const { isDarkMode, toggleTheme } = themeContext;
  const active = window.location.pathname;
  document.addEventListener('DOMContentLoaded', () => {
    const $navbarBurgers = Array.prototype.slice.call(
      document.querySelectorAll('.navbar-burger'),
      0
    );
    const anchors = document.querySelectorAll('.navbar-item');
    anchors.forEach((anchor) => {
      anchor.addEventListener('click', () => {
        document
          .querySelector('#navbarBasicExample')
          .classList.remove('is-active');

        document.querySelector('.navbar-burger').classList.remove('is-active');
      });
    });

    if ($navbarBurgers.length > 0) {
      $navbarBurgers.forEach((el) => {
        el.addEventListener('click', () => {
          const target = el.dataset.target;
          const $target = document.getElementById(target);
          el.classList.toggle('is-active');
          $target.classList.toggle('is-active');
        });
      });
    }
  });

  return (
    <nav
      className='navbar is-fixed-top is-light'
      role='navigation'
      id='navbar'
      aria-label='main navigation'
    >
      <div className='navbar-brand'>
        <Link className='navbar-item' id='brand' to='/'>
          <Terminal color={ isDarkMode ? '#FFCC4D' : 'blue'} />
          &emsp;WEBDEVSCOM
        </Link>

        <div
          role='button'
          className='navbar-burger burger'
          aria-label='menu'
          aria-expanded='false'
          data-target='navbarBasicExample'
        >
          <span aria-hidden='true'></span>
          <span aria-hidden='true'></span>
          <span aria-hidden='true'></span>
        </div>
      </div>

      <div id='navbarBasicExample' className='navbar-menu'>
        <div className='navbar-end'>
          <Link
            className={`navbar-item ${active === '/' ? 'is-active' : ''}`}
            to='/'
          >
            Home
          </Link>

          <Link
            className={`navbar-item ${active.includes('/resources') ? 'is-active' : ''
              }`}
            to='/resources'
          >
            Resources
          </Link>

          <Link
            className={`navbar-item ${active === '/bookmarked' ? 'is-active' : ''
              }`}
            to='/bookmarked'
          >
            My BookMarks
          </Link>

          <a
            className='navbar-item'
            rel='noopener noreferrer'
            target='_blank'
            href='https://github.com/WebDevsCom/webDevsCom/graphs/contributors'
          >
            Contributors
          </a>
          <div
            className='navbar-item'
            style={{ cursor: 'pointer' }}
            onClick={toggleTheme}
          >
            {isDarkMode ? <Sun color='#00d1b2' /> : <Moon color='#00d1b2' />}
          </div>
        </div>
      </div>
    </nav>
  );
}