Repository: mertJF/tailblocks Branch: master Commit: 34943e63da6a Files: 207 Total size: 851.1 KB Directory structure: gitextract_quo_pmco/ ├── .github/ │ └── FUNDING.yml ├── .gitignore ├── CNAME ├── LICENSE ├── README.md ├── package.json ├── public/ │ ├── ads.txt │ ├── index.html │ ├── manifest.json │ └── robots.txt └── src/ ├── App.js ├── App.test.js ├── blocks/ │ ├── blog/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ └── e.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ └── e.js │ ├── contact/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ └── c.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── content/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ ├── e.js │ │ │ ├── f.js │ │ │ ├── g.js │ │ │ └── h.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ ├── f.js │ │ ├── g.js │ │ └── h.js │ ├── cta/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ └── d.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ └── d.js │ ├── ecommerce/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ └── c.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── feature/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ ├── e.js │ │ │ ├── f.js │ │ │ ├── g.js │ │ │ └── h.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ ├── f.js │ │ ├── g.js │ │ └── h.js │ ├── footer/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ └── e.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ └── e.js │ ├── gallery/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ └── c.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── header/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ └── d.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ └── d.js │ ├── hero/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ ├── c.js │ │ │ ├── d.js │ │ │ ├── e.js │ │ │ └── f.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ └── f.js │ ├── index.js │ ├── pricing/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ └── b.js │ │ └── light/ │ │ ├── a.js │ │ └── b.js │ ├── statistic/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ └── c.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── step/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ └── c.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── team/ │ │ ├── dark/ │ │ │ ├── a.js │ │ │ ├── b.js │ │ │ └── c.js │ │ └── light/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ └── testimonial/ │ ├── dark/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ └── light/ │ ├── a.js │ ├── b.js │ └── c.js ├── icons/ │ ├── blog/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ └── e.js │ ├── contact/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── content/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ ├── f.js │ │ ├── g.js │ │ └── h.js │ ├── cta/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ └── d.js │ ├── ecommerce/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── feature/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ ├── f.js │ │ ├── g.js │ │ └── h.js │ ├── footer/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ └── e.js │ ├── gallery/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── header/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ └── d.js │ ├── hero/ │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ └── f.js │ ├── index.js │ ├── pricing/ │ │ ├── a.js │ │ └── b.js │ ├── statistic/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── step/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ ├── team/ │ │ ├── a.js │ │ ├── b.js │ │ └── c.js │ └── testimonial/ │ ├── a.js │ ├── b.js │ └── c.js ├── index.css ├── index.js ├── serviceWorker.js └── setupTests.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ patreon: mertcukuren ================================================ FILE: .gitignore ================================================ node_modules yarn.lock build ================================================ FILE: CNAME ================================================ tailblocks.cc ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2020 Mert Cukuren Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Tailblocks ### Ready-to-use Tailwind CSS blocks ##### Features * 60+ Blocks * Responsive * Dark Mode Support * Color Variations ## How to use this project [![tailblocks](https://github.com/mertjf/tailblocks/blob/master/public/preview.gif)](https://tailblocks.cc) This project provides multiple blocks built using [Tailwind CSS](https://tailwindcss.com/) that you can use in your own projects. This project is not a dependency that you add to your project, but instead provides you with HTML that you can easily copy and paste into your own project. To use the project: 1. Go to the [Tailblocks](https://tailblocks.cc) 1. Select a block that you would like to use. 1. Choose a color from the color palette for the block you selected. 1. Select whether you would like to use light or dark mode with the dark/light toggle button. 1. Click the "View Code" button. 1. Copy/paste into your project. 1. 🎉 ## License Code copyright 2020 Mert Cukuren. Code released under [the MIT license](https://github.com/mertjf/tailblocks/blob/master/LICENSE). ================================================ FILE: package.json ================================================ { "name": "tailblocks", "homepage": "https://tailblocks.cc", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", "html2jade": "^0.8.6", "react": "^16.12.0", "react-dom": "^16.12.0", "react-frame-component": "^4.1.1", "react-scripts": "3.4.0", "react-syntax-highlighter": "^12.2.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "predeploy": "yarn build", "deploy": "gh-pages -d build" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "gh-pages": "^2.2.0" } } ================================================ FILE: public/ads.txt ================================================ google.com, pub-7764280421704625, DIRECT, f08c47fec0942fa0 ================================================ FILE: public/index.html ================================================ Tailblocks — Ready-to-use Tailwind CSS blocks
================================================ FILE: public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", "type": "image/png", "sizes": "512x512" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: public/robots.txt ================================================ # https://www.robotstxt.org/robotstxt.html User-agent: * ================================================ FILE: src/App.js ================================================ import React, { Component } from 'react'; import Frame from 'react-frame-component'; import SyntaxHighlighter from 'react-syntax-highlighter'; import { vs2015, docco } from 'react-syntax-highlighter/dist/esm/styles/hljs'; import getBlock from './blocks'; import getIcons from './icons'; const iconList = getIcons(); const blockListArr = []; Object.entries(iconList).forEach(([type, icons]) => { Object.keys(icons).map(name => blockListArr.push(`${name},${type}`)); }); const themeList = ["indigo", "yellow", "red", "purple", "pink", "blue", "green"]; const desktopIcon = ( ); const phoneIcon = ( ); const tabletIcon = ( ); const clipboardIcon = ( ); const viewList = [ { icon: desktopIcon, name: 'desktop' }, { icon: tabletIcon, name: 'tablet' }, { icon: phoneIcon, name: 'phone' } ] class App extends Component { constructor(props) { super(props); this.state = { ready: false, darkMode: false, copied: false, sidebar: true, codeView: false, currentKeyCode: null, view: 'desktop', theme: 'indigo', blockType: 'Blog', blockName: 'BlogA', markup: '' } this.changeMode = this.changeMode.bind(this); this.changeTheme = this.changeTheme.bind(this); this.changeBlock = this.changeBlock.bind(this); this.handleContentDidMount = this.handleContentDidMount.bind(this); this.changeView = this.changeView.bind(this); this.toggleSidebar = this.toggleSidebar.bind(this); this.toggleView = this.toggleView.bind(this); this.copyToClipboard = this.copyToClipboard.bind(this); this.keyboardNavigation = this.keyboardNavigation.bind(this); this.markupRef = React.createRef(); this.textareaRef = React.createRef(); this.sidebarRef = React.createRef(); this.openerRef = React.createRef(); } componentDidMount() { document.addEventListener('keydown', this.keyboardNavigation); } hideSidebar() { const sidebar = this.sidebarRef.current; const opener = this.openerRef.current; document.addEventListener('click', (e) => { if (e.target === opener) { return; } if ((!e.target === sidebar || !sidebar.contains(e.target))) { this.setState({ sidebar: false }); } }); } keyboardNavigation(e) { const { blockType, blockName } = this.state; const blockStringFormat = `${blockName},${blockType}`; const keyCode = e.which || e.keyCode; switch (keyCode) { case 40: // Down e.preventDefault(); blockListArr.forEach((block, index) => { if (block === blockStringFormat) { const newActiveBlock = index + 1 <= blockListArr.length - 1 ? blockListArr[index + 1].split(',') : blockListArr[0].split(','); const newBlockName = newActiveBlock[0]; const newBlockType = newActiveBlock[1]; const newBlockNode = document.querySelector(`.block-item[block-name="${newBlockName}"]`); if (newBlockNode) newBlockNode.focus(); this.setState({ blockType: newBlockType, blockName: newBlockName, codeView: false, currentKeyCode: 40 }); } }); break; case 37: // Left e.preventDefault(); this.setState({ sidebar: false, currentKeyCode: 37 }); break; case 39: // Right e.preventDefault(); this.setState({ sidebar: true, currentKeyCode: 39 }); break; case 38: // Up e.preventDefault(); blockListArr.forEach((block, index) => { if (block === blockStringFormat) { const newActiveBlock = index - 1 >= 0 ? blockListArr[index - 1].split(',') : blockListArr[blockListArr.length - 1].split(','); const newBlockName = newActiveBlock[0]; const newBlockType = newActiveBlock[1]; const newBlockNode = document.querySelector(`.block-item[block-name="${newBlockName}"]`); if (newBlockNode) newBlockNode.focus(); this.setState({ blockType: newBlockType, blockName: newBlockName, codeView: false, currentKeyCode: 38 }); } }); break; default: return; } setTimeout(() => { if (keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) { this.setState({ currentKeyCode: null }) } }, 200); } changeMode() { this.setState({ darkMode: !this.state.darkMode }) } handleContentDidMount() { const iframe = document.querySelector('iframe'); iframe.contentWindow.document.addEventListener('keydown', this.keyboardNavigation); iframe.contentWindow.document.addEventListener('click', () => this.setState({ sidebar: false })); setTimeout(() => { this.setState({ ready: true, markup: this.markupRef.current.innerHTML }) }, 400); } beautifyHTML(codeStr) { const process = (str) => { let div = document.createElement('div'); div.innerHTML = str.trim(); return format(div, 0).innerHTML.trim(); } const format = (node, level) => { let indentBefore = new Array(level++ + 1).join(' '), indentAfter = new Array(level - 1).join(' '), textNode; for (let i = 0; i < node.children.length; i++) { textNode = document.createTextNode('\n' + indentBefore); node.insertBefore(textNode, node.children[i]); format(node.children[i], level); if (node.lastElementChild === node.children[i]) { textNode = document.createTextNode('\n' + indentAfter); node.appendChild(textNode); } } return node; } return process(codeStr); } changeBlock(e) { const { currentTarget } = e; const blockType = currentTarget.getAttribute('block-type'); const blockName = currentTarget.getAttribute('block-name'); this.setState({ blockType, blockName, codeView: false }); } changeTheme(e) { const { currentTarget } = e; const theme = currentTarget.getAttribute('data-theme'); this.setState({ theme }); } changeView(e) { const { currentTarget } = e; const view = currentTarget.getAttribute('data-view'); this.setState({ view, codeView: false }); } toggleView() { this.setState({ codeView: !this.state.codeView, view: 'desktop', markup: this.markupRef.current.innerHTML }) } themeListRenderer() { const { theme } = this.state; return themeList.map((t, k) => ) } listRenderer() { const { blockName } = this.state; return Object.entries(iconList).map(([type, icons]) =>
{type}
{Object.entries(icons).map(icon => )}
); } viewModeRenderer() { const { view } = this.state; return viewList.map((v, k) => ); } toggleSidebar() { this.setState({ sidebar: !this.state.sidebar }); } copyToClipboard() { const code = this.beautifyHTML(this.state.markup); var input = document.createElement('textarea'); input.innerHTML = code; document.body.appendChild(input); input.select(); document.execCommand('copy'); document.body.removeChild(input); this.setState({copied: true}); setTimeout(() => { this.setState({ copied: false }) }, 2000); } render() { const { darkMode, theme, blockName, blockType, sidebar, view, copied, currentKeyCode } = this.state; return (

Chicharrones blog helvetica normcore iceland tousled brook viral artisan.

); } DarkContactA.defaultProps = { theme: 'indigo' }; DarkContactA.propTypes = { theme: PropTypes.string.isRequired }; export default DarkContactA; ================================================ FILE: src/blocks/contact/dark/b.js ================================================ import React from "react"; import PropTypes from "prop-types"; function DarkContactB(props) { return (