├── .gitignore ├── favicon.ico ├── assets ├── demo.png └── demo-2.png ├── packages └── codenawis │ ├── src │ ├── components │ │ ├── list │ │ │ ├── index.js │ │ │ ├── sections │ │ │ │ ├── sectionTitles │ │ │ │ │ └── sectionTitle.js │ │ │ │ └── section6332.js │ │ │ ├── listItemNoImage.js │ │ │ ├── listItemHorizontalSmall.js │ │ │ ├── listItemOverlay.js │ │ │ ├── list-item.js │ │ │ ├── listItemHorizontal.js │ │ │ ├── list.js │ │ │ └── pagination.js │ │ ├── utitlity │ │ │ ├── avatar.js │ │ │ ├── cardTitle.js │ │ │ ├── Logo.js │ │ │ ├── Row.js │ │ │ ├── FlexCenter.js │ │ │ ├── cardContent.js │ │ │ ├── Hr.js │ │ │ ├── HoverLink.js │ │ │ ├── Container.js │ │ │ ├── FlexBetween.js │ │ │ ├── js │ │ │ │ └── functions.js │ │ │ ├── Article.js │ │ │ ├── getWidget.js │ │ │ ├── Col.js │ │ │ └── config │ │ │ │ └── homepageSections.js │ │ ├── meta │ │ │ ├── author.js │ │ │ ├── tags.js │ │ │ ├── categories.js │ │ │ ├── authorBox.js │ │ │ ├── date.js │ │ │ └── SharingButtons.js │ │ ├── footer.js │ │ ├── link.js │ │ ├── loading.js │ │ ├── header.js │ │ ├── menu-icon.js │ │ ├── menu-modal.js │ │ ├── menu.js │ │ ├── featured-media.js │ │ ├── page-error.js │ │ ├── SearchForm.js │ │ ├── title.js │ │ ├── nav.js │ │ ├── comments.js │ │ ├── index.js │ │ └── post.js │ └── index.js │ ├── node_modules │ └── .bin │ │ ├── he.ps1 │ │ ├── which.ps1 │ │ ├── mkdirp.ps1 │ │ ├── semver.ps1 │ │ ├── tsc.ps1 │ │ ├── envinfo.ps1 │ │ ├── loose-envify.ps1 │ │ ├── tsserver.ps1 │ │ ├── detect.ps1 │ │ ├── frontity.ps1 │ │ └── detect-port.ps1 │ ├── package.json │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ └── package-lock.json ├── package.json ├── frontity.settings.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.vercel 2 | /build 3 | /node_modules 4 | /now.json 5 | .vercel -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Componentity/frontity-codenawis/HEAD/favicon.ico -------------------------------------------------------------------------------- /assets/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Componentity/frontity-codenawis/HEAD/assets/demo.png -------------------------------------------------------------------------------- /assets/demo-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Componentity/frontity-codenawis/HEAD/assets/demo-2.png -------------------------------------------------------------------------------- /packages/codenawis/src/components/list/index.js: -------------------------------------------------------------------------------- 1 | import { loadable } from "frontity"; 2 | 3 | /** 4 | * Codesplit the list component so it's not included if the users 5 | * load a post directly. 6 | */ 7 | export default loadable(() => import("./list")); 8 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/avatar.js: -------------------------------------------------------------------------------- 1 | import { styled } from "frontity"; 2 | 3 | const Avatar = ({src}) => { 4 | return ( 5 | 6 | ) 7 | } 8 | 9 | const AvatarCss = styled.img` 10 | width: 65px !important; 11 | border-radius: 50%; 12 | margin-right: 10px; 13 | background-color: #eee; 14 | `; 15 | 16 | export default Avatar -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/cardTitle.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { styled } from "frontity"; 3 | 4 | const CardTitle = ({ title }) => { 5 | return ( 6 | 7 | ); 8 | }; 9 | export default CardTitle; 10 | 11 | const TitleCss = styled.h2` 12 | font-weight: 500; 13 | font-size: 1rem; 14 | `; -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/Logo.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {css} from 'frontity'; 3 | 4 | const Logo = ({color}) => { 5 | return ( 6 | <> 7 |

8 | CODENAWIS 9 |

10 | 11 | ) 12 | } 13 | 14 | export default Logo -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/Row.js: -------------------------------------------------------------------------------- 1 | import { styled } from "frontity"; 2 | 3 | const Row = ({children}) => { 4 | return ( 5 | 6 | {children} 7 | 8 | ) 9 | } 10 | 11 | const RowCss = styled.div` 12 | display: flex; 13 | flex-wrap: wrap; 14 | margin-right: -15px; 15 | margin-left: -15px 16 | `; 17 | export default Row 18 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/FlexCenter.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {styled} from 'frontity'; 3 | 4 | const FlexCenter = ({children}) => { 5 | return ( 6 | 7 | {children} 8 | 9 | ) 10 | } 11 | 12 | export default FlexCenter 13 | 14 | const FlexCenterCss = styled.div` 15 | display: flex; 16 | align-items: center; 17 | `; 18 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/cardContent.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {styled} from 'frontity'; 3 | 4 | const cardContent = ({children}) => { 5 | return ( 6 | 7 | {children} 8 | 9 | ) 10 | } 11 | 12 | const ContentCss = styled.div` 13 | margin:0 1.5rem; 14 | padding-bottom: 1.5rem; 15 | `; 16 | 17 | export default cardContent 18 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/Hr.js: -------------------------------------------------------------------------------- 1 | import { styled } from "frontity"; 2 | 3 | const Hr = ({children}) => { 4 | return ( 5 | 6 | {children} 7 | 8 | ) 9 | } 10 | 11 | const HrCss = styled.hr` 12 | margin-top: 1rem; 13 | margin-bottom: 1rem; 14 | border: 0; 15 | border-top: 1px solid #333; 16 | width: 100%; 17 | `; 18 | 19 | export default Hr 20 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/meta/author.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { connect } from "frontity"; 3 | import HoverLink from "../utitlity/HoverLink"; 4 | 5 | const Author = ({ state, authorId }) => { 6 | const author = state.source.author[authorId]; 7 | 8 | return ( 9 | 10 | 11 | {author?.name} 12 | 13 | 14 | ); 15 | }; 16 | 17 | export default connect(Author); -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/he.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../he/bin/he" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../he/bin/he" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/which.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../which/bin/which" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../which/bin/which" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/mkdirp.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/semver.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../semver/bin/semver" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/tsc.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../typescript/bin/tsc" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/envinfo.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../envinfo/dist/cli.js" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../envinfo/dist/cli.js" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/loose-envify.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../loose-envify/cli.js" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../loose-envify/cli.js" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/tsserver.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../typescript/bin/tsserver" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/detect.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../detect-port-alt/bin/detect-port" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../detect-port-alt/bin/detect-port" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/frontity.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../frontity/dist/src/cli/index.js" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../frontity/dist/src/cli/index.js" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/node_modules/.bin/detect-port.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pwsh 2 | $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent 3 | 4 | $exe="" 5 | if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { 6 | # Fix case when both the Windows and Linux builds of Node 7 | # are installed in the same directory 8 | $exe=".exe" 9 | } 10 | $ret=0 11 | if (Test-Path "$basedir/node$exe") { 12 | & "$basedir/node$exe" "$basedir/../detect-port-alt/bin/detect-port" $args 13 | $ret=$LASTEXITCODE 14 | } else { 15 | & "node$exe" "$basedir/../detect-port-alt/bin/detect-port" $args 16 | $ret=$LASTEXITCODE 17 | } 18 | exit $ret 19 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/HoverLink.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Link from '../link'; 3 | import { styled } from 'frontity'; 4 | 5 | const HoverLink = ({children, link}) => { 6 | return ( 7 | 8 | 9 | {children} 10 | 11 | 12 | ) 13 | } 14 | 15 | const HoverLinkCss = styled(Link)` 16 | a, a:visted { 17 | color: black !important; 18 | } 19 | :hover { 20 | transition: all .5s; 21 | color: #dc3545 !important; 22 | text-decoration: none; 23 | } 24 | `; 25 | 26 | export default HoverLink 27 | -------------------------------------------------------------------------------- /packages/codenawis/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codenawis-theme", 3 | "version": "1.1.0", 4 | "description": "A frontity theme by @mymakarim @codenawis", 5 | "author": "Yahya Makarim", 6 | "keywords": [ 7 | "frontity", 8 | "frontity-theme", 9 | "nextjs", 10 | "react", 11 | "wordpress" 12 | ], 13 | "homepage": "https://frontity.org", 14 | "license": "MIT", 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/mymakarim/frontity-codenawis" 18 | }, 19 | "bugs": { 20 | "url": "https://community.frontity.org" 21 | }, 22 | "dependencies": { 23 | "@frontity/components": "^1.4.0", 24 | "@frontity/html2react": "^1.3.4", 25 | "frontity": "^1.10.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codenawis", 3 | "version": "2.0.0", 4 | "private": true, 5 | "description": "Frontity project by @mymakarim @codenawis", 6 | "keywords": [ 7 | "frontity", 8 | "frontity-theme", 9 | "nextjs", 10 | "react", 11 | "wordpress" 12 | ], 13 | "scripts": { 14 | "dev": "frontity dev", 15 | "build": "frontity build", 16 | "serve": "frontity serve" 17 | }, 18 | "prettier": {}, 19 | "dependencies": { 20 | "@frontity/core": "^1.7.3", 21 | "@frontity/html2react": "^1.3.4", 22 | "@frontity/codenawis": "./packages/codenawis", 23 | "@frontity/tiny-router": "^1.2.1", 24 | "@frontity/wp-source": "^1.8.1", 25 | "frontity": "^1.10.1", 26 | "frontity-contact-form-7": "^0.1.7", 27 | "frontity-share": "^0.1.5" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/Container.js: -------------------------------------------------------------------------------- 1 | import { styled } from "frontity"; 2 | 3 | const Container = ({children}) => { 4 | return ( 5 | 6 | {children} 7 | 8 | ) 9 | } 10 | 11 | const ContainerWrapper = styled.div` 12 | width: 100%; 13 | padding-right: 15px; 14 | padding-left: 15px; 15 | margin-right: auto; 16 | margin-left: auto; 17 | padding-top: 10px; 18 | overflow: hidden; 19 | @media (min-width: 576px) { 20 | max-width: 540px; 21 | } 22 | @media (min-width: 768px){ 23 | max-width: 720px; 24 | } 25 | @media (min-width: 992px){ 26 | max-width: 960px; 27 | } 28 | @media (min-width: 1200px){ 29 | max-width: 1400px; 30 | } 31 | img { 32 | width: 100%; 33 | } 34 | `; 35 | 36 | export default Container 37 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/footer.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { connect } from "frontity"; 3 | import Container from './utitlity/Container'; 4 | import Hr from './utitlity/Hr'; 5 | import Logo from './utitlity/Logo'; 6 | import FlexBetween from './utitlity/FlexBetween'; 7 | 8 | const Footer = ({ state }) => { 9 | return ( 10 | <> 11 | 12 | 13 |
14 | 15 | {state.frontity.description} 16 | with Love by @mymakarim @codenawis 17 | 18 |
19 |
20 | 21 | ); 22 | }; 23 | 24 | // Connect the Header component to get access to the `state` in it's `props` 25 | export default connect(Footer); -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/FlexBetween.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {styled} from 'frontity'; 3 | 4 | const FlexBetween = ({children, direction="row"}) => { 5 | return ( 6 | 7 | {children} 8 | 9 | ) 10 | } 11 | 12 | export default FlexBetween 13 | 14 | const FlexBetweenCss = styled.div` 15 | display: flex; 16 | flex-direction: row; 17 | justify-content: space-between; 18 | align-items: start; 19 | gap: 20px; 20 | &.column { 21 | flex-direction: column; 22 | } 23 | &.row { 24 | > div:not(:last-child) { 25 | margin-right: 30px; 26 | } 27 | } 28 | @media (max-width: 570px){ 29 | &.row { 30 | flex-direction: column; 31 | > div:not(:last-child) { 32 | margin-right: 0; 33 | } 34 | } 35 | } 36 | `; 37 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/list/sections/sectionTitles/sectionTitle.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import HoverLink from "../../../utitlity/HoverLink"; 3 | import {styled} from 'frontity'; 4 | 5 | const SectionTitle = ({ category }) => { 6 | return ( 7 | 8 | 9 |

10 | 11 | {category.name}

12 | See All 13 |
14 |
15 | ); 16 | }; 17 | 18 | const FlexBetween = styled.div` 19 | display: flex; 20 | flex-direction: row; 21 | justify-content: space-between; 22 | align-items: center; 23 | `; 24 | 25 | export default SectionTitle -------------------------------------------------------------------------------- /packages/codenawis/src/components/meta/tags.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { connect, styled } from "frontity"; 3 | import Link from "../link"; 4 | 5 | const Tags = ({ state, tags }) => ( 6 | <> 7 | {tags.length > 0 ? ( 8 | <> 9 | Tags: 10 | {tags.map((tagId) => { 11 | const tag = state.source.tag[tagId]; 12 | return ( 13 | 14 | {tag?.name} 15 | 16 | ); 17 | })} 18 | 19 | ) : null} 20 | 21 | ); 22 | 23 | export default connect(Tags); 24 | 25 | const Wrapper = styled.span` 26 | display: inline; 27 | margin-right: .5rem; 28 | & a { 29 | color: #dc3545; 30 | font-weight: 500; 31 | font-size: 1rem; 32 | padding: 10px 0px 17px; 33 | } 34 | a:hover { 35 | transition: all .5s; 36 | color:black; 37 | } 38 | `; -------------------------------------------------------------------------------- /packages/codenawis/src/components/link.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { connect } from "frontity"; 3 | 4 | const Link = ({ 5 | state, 6 | actions, 7 | link, 8 | className, 9 | children, 10 | "aria-current": ariaCurrent, 11 | }) => { 12 | const onClick = (event) => { 13 | // Do nothing if it's an external link 14 | if (link.startsWith("http")) return; 15 | 16 | event.preventDefault(); 17 | // Set the router to the new url. 18 | actions.router.set(link); 19 | 20 | // Scroll the page to the top 21 | window.scrollTo(0, 0); 22 | 23 | // if the menu modal is open, close it so it doesn't block rendering 24 | if (state.theme.isMobileMenuOpen) { 25 | actions.theme.closeMobileMenu(); 26 | } 27 | }; 28 | 29 | return ( 30 | 36 | {children} 37 | 38 | ); 39 | }; 40 | 41 | export default connect(Link); 42 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/meta/categories.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { connect, styled } from "frontity"; 3 | import Link from "../link"; 4 | 5 | const Categories = ({ state, cats }) => ( 6 | <> 7 | {cats.length > 0 ? ( 8 | 9 | {" in "} 10 | {cats.map((catId, index) => { 11 | const isLast = !!(cats.length === index + 1); 12 | const cat = state.source.category[catId]; 13 | return ( 14 | 15 | {cat.name} 16 | {!isLast && ", "} 17 | 18 | ); 19 | })} 20 | 21 | ) : null} 22 | 23 | ); 24 | 25 | export default connect(Categories); 26 | 27 | const Wrapper = styled.span` 28 | display: inline; 29 | & a { 30 | color: #dc3545; 31 | font-weight: 600; 32 | font-size: 1rem; 33 | padding: 10px 0px 17px; 34 | } 35 | a:hover { 36 | transition: all .5s; 37 | color:black; 38 | } 39 | `; -------------------------------------------------------------------------------- /packages/codenawis/src/components/utitlity/js/functions.js: -------------------------------------------------------------------------------- 1 | import {categoryWidgets} from '../config/homepageSections' 2 | 3 | // export const getCategoriesIds = categories => Object.keys(categories) 4 | // export const getCategoriesValues = categories => Object.keys(categories) 5 | 6 | export const getPostsGroupedByCategory = source => { 7 | 8 | return categoryWidgets.map(categoryWidget=>{ 9 | const posts = getPostsFromCategory(source, categoryWidget.id).reverse().slice(0,categoryWidget.length) 10 | const category = source.category[categoryWidget.id] 11 | return {order: categoryWidget.order, posts, category} 12 | }); 13 | 14 | } 15 | 16 | export const getPostsFromCategory = ({ post }, categoryId) => 17 | Object.keys(post) 18 | .map(postID => post[postID]) 19 | .filter(({categories}) => categories.includes(+categoryId) ) 20 | 21 | export const createMarkupObject = renderedHtml => ({__html: renderedHtml}) 22 | 23 | export const getRandomColor = () => 24 | '#' + new Array(6).fill(0).map(digit => '0123456789ABCDEF'[Math.floor(Math.random() * 16)]).join('') 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/loading.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { styled, keyframes, css } from "frontity"; 3 | 4 | const scale = keyframes` 5 | 0% {transform: scaley(1.0)} 6 | 50% {transform: scaley(0.4)} 7 | 100% {transform: scaley(1.0)} 8 | `; 9 | 10 | const Loading = () => ( 11 | 12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 20 | ); 21 | 22 | export default Loading; 23 | 24 | const bar = index => css` 25 | background-color: #dc3545; 26 | width: 4px; 27 | height: 24px; 28 | margin: 3px; 29 | border-radius: 0; 30 | display: inline-block; 31 | animation: ${scale} 1s ${index * 0.1}s infinite 32 | cubic-bezier(0.2, 0.68, 0.18, 1.08); 33 | animation-fill-mode: both; 34 | `; 35 | 36 | const Container = styled.div` 37 | width: 800px; 38 | margin: 0; 39 | padding: 24px; 40 | display: flex; 41 | justify-content: center; 42 | align-items: center; 43 | 44 | & > * { 45 | margin-top: 24px; 46 | } 47 | `; 48 | -------------------------------------------------------------------------------- /packages/codenawis/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Yahya Makarim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/codenawis/src/components/header.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { connect, styled } from "frontity"; 3 | import Link from "./link"; 4 | import Nav from "./nav"; 5 | import MobileMenu from "./menu"; 6 | import Container from './utitlity/Container' 7 | import Hr from './utitlity/Hr' 8 | import Logo from './utitlity/Logo' 9 | import SearchForm from './SearchForm'; 10 | 11 | const Header = ({ state }) => { 12 | return ( 13 | <> 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 |