repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
ErwinYou/react-blog
src/utils/apis/setData.ts
<filename>src/utils/apis/setData.ts import { db } from '../cloudBase'; export const setData = (config: { DBName: string; name: string; email: string; link: string; content: string; date: number; avatar: string; postTitle: string; replyId: string; }) => { const { DBName, name, email, link, content, ...
ErwinYou/react-blog
src/pages/Home/Aside/SiteCard/useRunTime.ts
import { useMount,useSafeState } from 'ahooks'; import dayjs from 'dayjs'; import { time } from '@/utils/constant'; export const useRunTime = () => { const [runTime, setRunTime] = useSafeState(0); useMount(() => { const nowTime = new Date().getTime(); const startTime = new Date(time).getTime(); const...
ErwinYou/react-blog
src/components/Comment/EditBox/PreShow/index.tsx
<reponame>ErwinYou/react-blog import { useMemoizedFn } from 'ahooks'; import classNames from 'classnames'; import React from 'react'; import sanitizeHtml from 'sanitize-html'; import MarkDown from '@/components/MarkDown'; import s from './index.scss'; interface Props { closePre?: Function; content?: s...
ErwinYou/react-blog
src/redux/reducers/index.ts
import { combineReducers } from 'redux'; import artSum from './artSum'; import avatar from './avatar'; import email from './email'; import link from './link'; import mode from './mode'; import name from './name'; import navShow from './navShow'; export default combineReducers({ navShow, artSum, avatar, email,...
ErwinYou/react-blog
src/pages/Home/Aside/DataCard/index.tsx
import { useRequest } from 'ahooks'; import React from 'react'; import { connect } from 'react-redux'; import { useNavigate } from 'react-router-dom'; import Card from '@/components/Card'; import { setArtSum } from '@/redux/actions'; import { DB } from '@/utils/apis/dbConfig'; import { staleTime } from '@/utils/consta...
ErwinYou/react-blog
src/pages/Home/Aside/AccountCard/Csdn/index.tsx
<reponame>ErwinYou/react-blog import React from 'react'; import s from './index.scss'; const Csdn: React.FC = () => ( <svg className={s.csdn} viewBox='0 0 1024 1024'> <path d='M512 0c282.784 0 512 229.216 512 512s-229.216 512-512 512S0 794.784 0 512 229.216 0 512 0z m189.952 752l11.2-108.224c-31.904 9.536-100.9...
ErwinYou/react-blog
src/components/Comment/EditBox/index.tsx
import useUrlState from '@ahooksjs/use-url-state'; import { UserOutlined } from '@ant-design/icons'; import { useBoolean, useKeyPress, useLocalStorageState, useMemoizedFn, useMount, useRequest, useSafeState } from 'ahooks'; import { message } from 'antd'; import classNames from 'classnames'; ...
ErwinYou/react-blog
src/components/Comment/Placehold/index.tsx
import React from 'react'; import s from './index.scss'; interface Props { msgCount?: number; isMsg?: boolean; } const Placehold: React.FC<Props> = ({ msgCount, isMsg }) => { return ( <> {msgCount ? ( <div className={s.hasMag}> {msgCount}条{isMsg ? '留言' : '评论'} </div> )...
ErwinYou/react-blog
src/pages/Say/SayPop/index.tsx
<reponame>ErwinYou/react-blog import dayjs from 'dayjs'; import React from 'react'; import { myAvatar70 } from '@/utils/constant'; import s from './index.scss'; interface Props { content?: string; date?: number; } const SayPop: React.FC<Props> = ({ content, date }) => ( <div className={s.sayItem}> <div cl...
ErwinYou/react-blog
src/utils/apis/getSum.ts
<reponame>ErwinYou/react-blog import { db } from '../cloudBase'; export const getSum = (dbName: string) => db .collection(dbName) .count() .then(res => res) .catch(err => err);
ErwinYou/react-blog
src/utils/function.ts
<reponame>ErwinYou/react-blog<filename>src/utils/function.ts<gh_stars>0 /** * 生成指定范围内的随机整数,左闭右闭 * @param {Number} Min * @param {Number} Max * @return {Number} */ export const getRandomNum = (Min: number, Max: number) => { const Range = Max - Min + 1; const Rand = Math.random(); return Min + Math.floor(Rand *...
ErwinYou/react-blog
src/redux/constant.ts
<filename>src/redux/constant.ts export const SET_NAV_SHOW = 'setNavShow'; export const SET_ART_SUM = 'setArtSum'; export const SET_NAME = 'setName'; export const SET_EMAIL = 'setEmail'; export const SET_LINK = 'setLink'; export const SET_AVATAR = 'setAvatar'; export const SET_MODE = 'setMode';
ErwinYou/react-blog
src/components/Nav/config.ts
<reponame>ErwinYou/react-blog export const useLinkList = () => { const navArr = [ { name: '图库', to: '/gallery' }, { name: '说说', to: '/say' }, { name: '留言', to: '/msg' }, { name: '友链', to: '/link' }, { name: '作品', to: '/show' }, { name: '建站', to: '/log' }, { name: '关于', to: '/about' } ]; ...
ErwinYou/react-blog
src/utils/hooks/useLazyImg.ts
import { useInViewport, useSafeState } from 'ahooks'; import { useEffect, useRef } from 'react'; export const useLazyImg = (avatar: string, loading: string) => { const imgRef = useRef(null); // eslint-disable-next-line no-unused-vars const [_, ratio] = useInViewport(imgRef, { threshold: [1] }); const [i...
ErwinYou/react-blog
src/utils/apis/dbConfig.ts
/* eslint-disable no-unused-vars */ export enum DB { About = 'about', Msg = 'allComments', Article = 'articles', Class = 'classes', Drafe = 'drafts', Gallery = 'galleries', Link = 'links', Log = 'logs', Notice = 'notice', Say = 'says', Show = 'shows', Count = 'siteCount', Tag = 'tags' }
ErwinYou/react-blog
src/pages/Img/ImgView/index.tsx
<reponame>ErwinYou/react-blog import classNames from 'classnames'; import React, { MouseEventHandler } from 'react'; import s from './index.scss'; interface Props { viewUrl?: string; isViewShow?: boolean; onClick?: MouseEventHandler<HTMLDivElement>; } const ImgView: React.FC<Props> = ({ viewUrl, isViewShow, on...
ErwinYou/react-blog
src/pages/Gallery/ImgCard/index.tsx
<filename>src/pages/Gallery/ImgCard/index.tsx import React from 'react'; import { useNavigate } from 'react-router-dom'; import s from './index.scss'; interface Props { cover?: string; title?: string; descr?: string; } const ImgCard: React.FC<Props> = ({ cover, title, descr }) => { const navigate = useNaviga...
ErwinYou/react-blog
src/pages/Home/Section/PostCard/index.tsx
import dayjs from 'dayjs'; import React, { MouseEventHandler } from 'react'; import Card from '@/components/Card'; import s from './index.scss'; import PostCardLoading from './PostCardLoading'; interface Props { title?: string; content?: string; date?: number; tags?: string[]; loading?: boolean; onClick?...
ErwinYou/react-blog
src/components/Comment/EditBox/Emoji/EmojiItem/index.tsx
import { message } from 'antd'; import copy from 'copy-to-clipboard'; import React from 'react'; import s from './index.scss'; interface Props { emojiStr: string[]; } const EmojiItem: React.FC<Props> = ({ emojiStr }) => { return ( <> {emojiStr.map((item: string, index: number) => ( ...
ErwinYou/react-blog
src/utils/hooks/useTime.ts
<filename>src/utils/hooks/useTime.ts // import { useMount, useSafeState } from 'ahooks'; export const useTime = () => { const hour = new Date().getHours(); const timeText = hour < 6 ? '凌晨好' : hour < 9 ? '早上好' : hour < 11 ? '上午好' : hour < 13 ? '中午好' : hour < 17 ...
ErwinYou/react-blog
src/components/Main/index.tsx
<filename>src/components/Main/index.tsx<gh_stars>0 import React, { lazy, Suspense } from 'react'; import { Navigate, Route, Routes } from 'react-router-dom'; import ErrorBoundary from '@/components/ErrorBoundary'; import s from './index.scss'; const Home = lazy(() => import(/* webpackPrefetch:true */ '@/pages/Home')...
ErwinYou/react-blog
src/redux/actions.ts
import { SET_ART_SUM, SET_AVATAR, SET_EMAIL, SET_LINK, SET_MODE, SET_NAME, SET_NAV_SHOW } from './constant'; export const setNavShow = (data: boolean) => ({ type: SET_NAV_SHOW, data }); export const setArtSum = (data: number) => ({ type: SET_ART_SUM, data }); export const setName = (data: strin...
ErwinYou/react-blog
src/pages/Home/Aside/ClockCard/index.tsx
import { useInterval } from 'ahooks'; import React from 'react'; import Card from '@/components/Card'; import s from './index.scss'; import { useClock } from './useClock'; const ClockCard: React.FC = () => { const { hour, minute, second, runPerSecond } = useClock(); useInterval(runPerSecond, 1000); return ( ...
ErwinYou/react-blog
src/components/PageTitle/index.tsx
<reponame>ErwinYou/react-blog<gh_stars>0 import classNames from 'classnames'; import React from 'react'; import s from './index.scss'; interface Props { title?: string; desc?: string; className?: string; } const PageTitle: React.FC<Props> = ({ title, desc, className, children }) => { return ( <div classN...
ErwinYou/react-blog
src/components/LayoutLoading/index.tsx
import { Skeleton } from 'antd'; import React from 'react'; interface Props { rows?: number; } const LayoutLoading: React.FC<Props> = ({ rows = 10 }) => ( <Skeleton paragraph={{ rows }} /> ); export default LayoutLoading;
ErwinYou/react-blog
src/components/Layout/index.tsx
import { useTitle } from 'ahooks'; import classNames from 'classnames'; import dayjs from 'dayjs'; import React from 'react'; import { connect } from 'react-redux'; import { setNavShow } from '@/redux/actions'; import { siteTitle } from '@/utils/constant'; import useTop from '@/utils/hooks/useTop'; import Card from '...
ErwinYou/react-blog
src/components/Footer/index.tsx
import React from 'react'; import { icp_no, icp_site, source_github } from '@/utils/constant'; import s from './index.scss'; const Footer: React.FC = () => { const frameArr = [ 'React', 'React Router', 'Redux', 'Webpack', 'AntD', 'ahooks', 'CloudBase' ]; return ( <footer classN...
ErwinYou/react-blog
src/pages/About/AboutSite/Chart/useOption.ts
import { ClassType } from '..'; const getChartData = (classes: ClassType[], artSum: number) => { let sum = 0; const res = classes.map(obj => { sum += obj.count; return { name: obj.class, value: obj.count }; }); const leave = artSum - sum; leave && res.push({ name: '未分类', value: leave ...
ErwinYou/react-blog
src/components/Card/index.tsx
<gh_stars>0 import { Skeleton } from 'antd'; import classNames from 'classnames'; import React, { MouseEventHandler } from 'react'; import s from './index.scss'; interface Props { className?: string; loading?: boolean; isStatic?: boolean; onClick?: MouseEventHandler<HTMLDivElement>; } const Card: React.FC<Pr...
ErwinYou/react-blog
src/pages/Classes/ClassBar/index.tsx
import classNames from 'classnames'; import React, { MouseEventHandler } from 'react'; import s from './index.scss'; interface Props { content: string; num: number; className?: string; onClick?: MouseEventHandler<HTMLDivElement>; } const ClassBar: React.FC<Props> = ({ content, num, onClick, className }) => {...
ErwinYou/react-blog
src/pages/Post/Navbar/index.tsx
<reponame>ErwinYou/react-blog import './index.custom.scss'; import { MenuFoldOutlined } from '@ant-design/icons'; import { useBoolean } from 'ahooks'; import { Drawer } from 'antd'; import classNames from 'classnames'; import MarkNav from 'markdown-navbar'; import React from 'react'; import { connect } from 'react-red...
ErwinYou/react-blog
src/components/Comment/Divider/index.tsx
<reponame>ErwinYou/react-blog import React from 'react'; import s from './index.scss'; const Divider: React.FC = () => <div className={s.divider} />; export default Divider;
keyboard-clacker/vscode
src/vs/editor/contrib/goToDeclaration/browser/clickLinkGesture.ts
<gh_stars>0 /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------...
keyboard-clacker/vscode
extensions/emmet/src/selectItemStylesheet.ts
<filename>extensions/emmet/src/selectItemStylesheet.ts /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------...
keyboard-clacker/vscode
src/vs/base/common/objects.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
keyboard-clacker/vscode
extensions/typescript/src/utils/buildStatus.ts
<filename>extensions/typescript/src/utils/buildStatus.ts /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *------...
keyboard-clacker/vscode
extensions/emmet/src/emmetCompletionProvider.ts
<reponame>keyboard-clacker/vscode /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *-----------------------------...
keyboard-clacker/vscode
extensions/typescript/src/features/documentSymbolProvider.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
keyboard-clacker/vscode
src/vs/workbench/parts/tasks/browser/quickOpen.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
keyboard-clacker/vscode
src/vs/code/node/keyboard.ts
<filename>src/vs/code/node/keyboard.ts /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *------------------------...
keyboard-clacker/vscode
src/vs/workbench/parts/debug/electron-browser/debugViews.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
keyboard-clacker/vscode
src/vs/workbench/parts/views/browser/views.ts
<reponame>keyboard-clacker/vscode /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *-----------------------------...
keyboard-clacker/vscode
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
<gh_stars>0 /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------...
keyboard-clacker/vscode
extensions/emmet/src/toggleComment.ts
<reponame>keyboard-clacker/vscode<gh_stars>0 /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *------------------...
keyboard-clacker/vscode
src/vs/workbench/api/node/extHostTask.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
keyboard-clacker/vscode
src/vs/editor/common/config/fontInfo.ts
<reponame>keyboard-clacker/vscode<filename>src/vs/editor/common/config/fontInfo.ts<gh_stars>0 /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project r...
keyboard-clacker/vscode
extensions/markdown/src/previewContentProvider.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
keyboard-clacker/vscode
extensions/typescript/src/features/referenceProvider.ts
<gh_stars>0 /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------...
sandy081/vscode-emacs-mcx
src/commands/rectangle.ts
import * as vscode from "vscode"; import { TextEditor } from "vscode"; import { EmacsCommand, IEmacsCommandInterrupted } from "."; import { IEmacsCommandRunner, IMarkModeController } from "../emulator"; import { getNonEmptySelections, makeSelectionsEmpty } from "./helpers/selection"; import { convertSelectionToRectSele...
sandy081/vscode-emacs-mcx
src/test/suite/commands/kill-yank/kill-whole-line.test.ts
import assert from "assert"; import * as vscode from "vscode"; import { Position, Selection } from "vscode"; import { EmacsEmulator } from "../../../../emulator"; import { assertTextEqual, cleanUpWorkspace, clearTextEditor, setupWorkspace } from "../../utils"; suite("Emulator.killWholeLine", () => { let activeTextEd...
deividr/nlw-01
web/src/pages/CreatePoint/index.tsx
import React, { useEffect, useState, ChangeEvent, FormEvent } from 'react'; import Dropzone from '../../components/Dropzone/index'; import { Link, useHistory } from 'react-router-dom'; import { Map, Marker, Popup, TileLayer } from 'react-leaflet'; import { FiArrowLeft } from 'react-icons/fi'; import axios from 'axios';...
deividr/nlw-01
server/src/routes.ts
<reponame>deividr/nlw-01 import express from 'express'; import itemsRoutes from './routers/items'; import itemsPoints from './routers/points'; const routes = express.Router(); routes.use(itemsRoutes); routes.use(itemsPoints); export default routes;
deividr/nlw-01
server/src/routers/points.ts
import { Router } from 'express'; import PointsController from '../controllers/PointsController'; import multer from 'multer'; import storage from '../config/multer'; import path from 'path'; import { celebrate, Joi } from 'celebrate'; const uploads = multer({ storage, fileFilter: (request, file, callback) => { ...
deividr/nlw-01
server/src/routers/items.ts
import { Router } from 'express'; import ItemsController from '../controllers/ItemsController'; const routes = Router(); const itemsController = new ItemsController(); routes.get('/items', itemsController.index); export default routes;
viniciusflv/gatsby-ts
src/components/Lang/index.tsx
import React, { FC, memo } from 'react'; import { IntlProvider } from 'gatsby-plugin-intl'; import { LangProvider } from './context'; import { useHooks } from './hooks'; import { RootElementArgs } from '../../../gatsby-api'; export const Lang: FC<RootElementArgs> = memo(({ children, loadPageSync }) => { const { ...
viniciusflv/gatsby-ts
src/components/Core/Text/index.tsx
<gh_stars>0 import React, { ComponentType, FC, memo } from 'react'; import { TextProps, TextTypes } from './interface'; import * as TextStyles from './style'; export const Text: FC<TextProps> = memo( ({ children, text, type = TextTypes.Span, ...props }) => { const Tag = TextStyles[type]; const content = chi...
viniciusflv/gatsby-ts
src/components/Core/Svg/style.ts
<filename>src/components/Core/Svg/style.ts import styled from 'styled-components'; import { Flex } from '../Flex'; export const WrapperStyle = Flex; export const SvgStyle = styled.svg` width: 100%; height: 100%; `;
viniciusflv/gatsby-ts
src/components/Core/Grid/interface.ts
<filename>src/components/Core/Grid/interface.ts import { ContainerProps } from '../Container/interface'; export type GridProps<T = {}> = ContainerProps< T & { areas?: string; columns?: string; rows?: string; gap?: string; } >;
viniciusflv/gatsby-ts
src/components/Theme/models.ts
<filename>src/components/Theme/models.ts import { ThemeType } from './interfaces'; export const light: ThemeType = { headline: { size: '3rem', color: '#222222', weight: 'bold', family: 'Raleway, arial, sans-serif', }, subhead: { size: '2rem', color: '#222222', weight: 'bold', fami...
viniciusflv/gatsby-ts
src/components/Core/IconText/style.ts
import { Flex } from '../Flex'; import { Svg } from '../Svg'; import { Text } from '../Text'; export const WrapperStyle = Flex; export const FirstIconStyle = Svg; export const LastIconStyle = Svg; export const TextStyle = Text;
viniciusflv/gatsby-ts
src/assets/index.ts
<filename>src/assets/index.ts import vectors from './vectors.json'; export default vectors;
viniciusflv/gatsby-ts
src/components/Theme/index.tsx
import React, { memo, useState } from 'react'; import { ThemeProvider } from 'styled-components'; import { dark, light } from './models'; export const Theme = memo(({ children }) => { const [toggle, setToggle] = useState(true); const toggleTheme = () => setToggle(!toggle); const applyThemeSwitcher = (theme: an...
viniciusflv/gatsby-ts
src/components/Core/Container/index.tsx
<filename>src/components/Core/Container/index.tsx export { ContainerStyle as Container } from './style';
viniciusflv/gatsby-ts
src/components/Core/IconText/interface.ts
import { SvgProps, VectorTypes } from '../Svg/interface'; import { TextProps } from '../Text/interface'; export type IconProps = VectorTypes | SvgProps; export interface IconTextProps extends Omit<TextProps, 'size'> { first?: IconProps; last?: IconProps; size?: number; fill?: string; }
viniciusflv/gatsby-ts
src/components/TopBar/model.ts
<reponame>viniciusflv/gatsby-ts import { useTheme } from 'styled-components'; import { FlexProps } from '../Core/Flex/interface'; import { PaperProps } from '../Core/Paper/interface'; export class TopBarModels { HeaderModel: FlexProps; FixedModel: PaperProps; NavModel: FlexProps; constructor() { const { p...
viniciusflv/gatsby-ts
src/components/Core/Flex/index.tsx
export { FlexStyle as Flex } from './style';
viniciusflv/gatsby-ts
src/components/Markdown/style.ts
<gh_stars>0 import styled from 'styled-components'; const CodeStyle = styled.section` code[class*='language-'], pre[class*='language-'] { color: ${({ theme }) => theme.code.color}; background: none; text-shadow: 0 1px rgba(0, 0, 0, 0.3); font-family: ${({ theme }) => theme.code.family}; font-si...
viniciusflv/gatsby-ts
src/components/SEO/hooks.ts
import { graphql, useStaticQuery } from 'gatsby'; import { useLang } from '../Lang/context'; export function useHooks() { const { messages } = useLang(); const { site: { siteMetadata: data }, } = useStaticQuery( graphql` query { site { siteMetadata { siteUrl ...
viniciusflv/gatsby-ts
src/components/Core/Link/index.tsx
<reponame>viniciusflv/gatsby-ts<gh_stars>0 import React, { FC } from 'react'; import { join } from 'path'; import { LinkStyle, TextStyle } from './style'; import { useLang } from '../../Lang/context'; export const Link: FC<any> = ({ children, to }) => { const { locale } = useLang(); return ( <LinkStyle to=...
viniciusflv/gatsby-ts
src/components/Core/Base/index.tsx
export { BaseStyle as Base } from './style';
viniciusflv/gatsby-ts
src/components/TopBar/style.ts
import { TopBarModels } from './model'; import { Flex } from '../Core/Flex'; import { Paper } from '../Core/Paper'; export const HeaderStyle = Flex; export const FixedStyle = Paper; export const NavStyle = Flex;
viniciusflv/gatsby-ts
src/components/Theme/interfaces.ts
interface TextThemeType { size: string; family: string; color: string; weight: string; } interface Code { boxShadow: string; family: string; size: string; color: string; backgroundColor: string; commentColor: string; punctuationColor: string; parameterColor: string; boolNumberColor: string; ...
viniciusflv/gatsby-ts
src/components/Core/Text/interface.ts
import { ComponentType } from 'react'; import * as TextStyles from './style'; import { ContainerProps } from '../Container/interface'; export enum TextTypes { Span = 'SpanStyle', H1 = 'H1Style', H2 = 'H2Style', H3 = 'H3Style', H4 = 'H4Style', // Hr = 'HrStyle', // Caption = 'CaptionStyle', // Th = 'T...
viniciusflv/gatsby-ts
src/components/Core/Base/interface.ts
<gh_stars>0 export type BaseProps<T = {}> = T & React.HTMLAttributes<T> & { as?: keyof JSX.IntrinsicElements | React.ComponentType<any>; theme?: any; content?: string; grow?: string; outline?: string; transition?: string; cursor?: string; pointerEvents?: string; opacity?: string; ...
viniciusflv/gatsby-ts
src/components/Pages/index.tsx
import React, { Fragment, memo } from 'react'; import { FormattedMessage } from 'gatsby-plugin-intl'; import assets from '../../assets'; import { Flex } from '../Core/Flex'; import { IconText } from '../Core/IconText'; import { Svg } from '../Core/Svg'; import { Text } from '../Core/Text'; import { TextTypes } from '...
viniciusflv/gatsby-ts
src/components/App/style.ts
<filename>src/components/App/style.ts import { createGlobalStyle } from 'styled-components'; import { ThemeType } from '../Theme/interfaces'; export const GlobalStyle = createGlobalStyle<{ theme: ThemeType }>` * { box-sizing: border-box; outline-color: ${({ theme }) => theme.secondaryColor}; } html, bo...
viniciusflv/gatsby-ts
src/components/TopBar/index.tsx
<gh_stars>0 import React, { memo } from 'react'; import { graphql, useStaticQuery } from 'gatsby'; import { useTheme } from 'styled-components'; import { TopBarModels } from './model'; import { FixedStyle, HeaderStyle, NavStyle } from './style'; import { useLang } from '../Lang/context'; import { Menu } from '../Men...
viniciusflv/gatsby-ts
gatsby-api.tsx
<reponame>viniciusflv/gatsby-ts import React from 'react'; import { ReplaceComponentRendererArgs, WrapPageElementBrowserArgs, WrapPageElementNodeArgs, WrapRootElementBrowserArgs, WrapRootElementNodeArgs, } from 'gatsby'; import { IntlConfig } from 'gatsby-plugin-intl'; import { App } from './src/components/...
viniciusflv/gatsby-ts
src/components/Core/Flex/interface.ts
<filename>src/components/Core/Flex/interface.ts<gh_stars>0 import { ContainerProps } from '../Container/interface'; export type FlexProps<T = {}> = ContainerProps< T & { direction?: string; justifyContent?: string; alignItems?: string; wrap?: string; gap?: string; } >;
viniciusflv/gatsby-ts
src/components/Core/Svg/interface.ts
<filename>src/components/Core/Svg/interface.ts<gh_stars>0 import assets from '../../../assets'; import { FlexProps } from '../Flex/interface'; export interface Stop { offset: string; stopColor: string; } export interface Gradient { stops: Array<Stop>; } export interface Animate { fill: string; begin: strin...
viniciusflv/gatsby-ts
src/components/Core/IconText/index.tsx
import React, { FC, memo } from 'react'; import { IconTextProps } from './interface'; import { IconTextModel } from './model'; import { FirstIconStyle, LastIconStyle, TextStyle, WrapperStyle, } from './style'; export const IconText: FC<IconTextProps> = memo((props) => { const { first, last } = props; cons...
viniciusflv/gatsby-ts
src/components/Core/Paper/interface.ts
import { FlexProps } from '../Flex/interface'; export type PaperProps<T = {}> = FlexProps< T & { elevation?: number; } >;
viniciusflv/gatsby-ts
src/components/Menu/index.tsx
<reponame>viniciusflv/gatsby-ts<filename>src/components/Menu/index.tsx import React from 'react'; import { graphql, useStaticQuery } from 'gatsby'; import { useTheme } from 'styled-components'; import { Link } from '../Core/Link'; export const Menu = () => { const { allSitePage: { nodes }, } = useStaticQuery...
viniciusflv/gatsby-ts
src/components/Markdown/index.tsx
<gh_stars>0 import React, { FC, memo } from 'react'; import { MarkdownStyle } from './style'; export const Markdown: FC<{ html: string }> = memo(({ html }) => { return <MarkdownStyle dangerouslySetInnerHTML={{ __html: html }} />; });
viniciusflv/gatsby-ts
src/components/Core/Paper/style.ts
<reponame>viniciusflv/gatsby-ts<filename>src/components/Core/Paper/style.ts<gh_stars>0 import styled from 'styled-components'; import { PaperProps } from './interface'; import { Flex } from '../Flex'; const getElevation = (ele: number) => { switch (ele) { case 1: return '0 1px 3px rgba(0,0,0,0.12), 0 1px...
viniciusflv/gatsby-ts
src/components/Lang/context.ts
<filename>src/components/Lang/context.ts<gh_stars>0 import { createContext, useContext } from 'react'; import { useIntl } from 'gatsby-plugin-intl'; export const LangContext = createContext({}); export const LangProvider = LangContext.Provider; export function useLang() { return Object.assign(useIntl(), useContext...
viniciusflv/gatsby-ts
src/components/Core/Base/style.ts
<gh_stars>0 import styled from 'styled-components'; import { BaseProps } from './interface'; export const BaseStyle = styled.div<BaseProps>` ${({ content }) => content && `content: ${content};`} ${({ grow }) => grow && `flex-grow: ${grow};`} ${({ outline }) => outline && `outline: ${outline};`} ${({ transitio...
viniciusflv/gatsby-ts
src/components/SEO/index.tsx
<gh_stars>0 import React, { FC, memo } from 'react'; import { Helmet } from 'react-helmet'; import { join } from 'path'; import { useHooks } from './hooks'; export const SEO: FC<{ title?: string; description?: string; path?: string; }> = memo(({ title, description, path }) => { const data = useHooks(); con...
viniciusflv/gatsby-ts
src/components/Core/Grid/index.tsx
<gh_stars>0 export { GridStyle as Grid } from './style';
viniciusflv/gatsby-ts
src/components/Pages/style.ts
<filename>src/components/Pages/style.ts import styled from 'styled-components'; export const HeadlineStyle = styled.h1` font-size: ${({ theme }) => theme.headline.size}; font-family: ${({ theme }) => theme.headline.family}; font-weight: ${({ theme }) => theme.headline.weight}; color: ${({ theme }) => theme.hea...
viniciusflv/gatsby-ts
src/components/App/index.tsx
import React, { FC, memo, useEffect, useState } from 'react'; import { WrapRootElementBrowserArgs, WrapRootElementNodeArgs } from 'gatsby'; import { GlobalStyle } from './style'; import { RootElementArgs } from '../../../gatsby-api'; import { Lang } from '../Lang'; import { SEO } from '../SEO'; import { Theme } from...
viniciusflv/gatsby-ts
src/components/Core/Grid/style.ts
import styled from 'styled-components'; import { GridProps } from './interface'; import { Container } from '../Container'; export const GridStyle = styled(Container).attrs(({ display }: GridProps) => ({ display: display || 'grid', }))<GridProps>` ${({ columns }) => columns && `grid-template-columns:${columns};...
viniciusflv/gatsby-ts
src/components/Core/Text/style.ts
<reponame>viniciusflv/gatsby-ts import styled from 'styled-components'; import { TextProps } from './interface'; import { Container } from '../Container'; export const TextStyle = styled(Container).attrs({ as: 'span' })<TextProps>` font-stretch: inherit; font-family: inherit; word-spacing: inherit; text-alig...
viniciusflv/gatsby-ts
src/components/Layout/index.tsx
<gh_stars>0 import React, { FC, memo, useEffect } from 'react'; import { useTheme } from 'styled-components'; import { Flex } from '../Core/Flex'; import { Grid } from '../Core/Grid'; import { SEO } from '../SEO'; import { TopBar } from '../TopBar'; export const Layout: FC<any> = memo(({ children, path }) => { con...
viniciusflv/gatsby-ts
src/components/Templates/Blog/index.tsx
<reponame>viniciusflv/gatsby-ts import React, { Fragment, memo } from 'react'; import { graphql } from 'gatsby'; import { Flex } from '../../Core/Flex'; import { Text } from '../../Core/Text'; import { TextTypes } from '../../Core/Text/interface'; import { Markdown } from '../../Markdown'; import { SEO } from '../../...
viniciusflv/gatsby-ts
src/components/Core/Container/style.ts
<gh_stars>0 import styled from 'styled-components'; import { Border, BorderRadius, ContainerProps, X, XY, Y } from './interface'; import { Base } from '../Base'; const getXYRadius = ( yKey: keyof Y<string>, xKey: keyof X<string>, xy: string ) => { return ` border-${yKey}-${xKey}-radius: ${xy}; ...
viniciusflv/gatsby-ts
src/components/Pages/404/index.tsx
import React, { memo } from 'react'; import { Svg } from '../../Core/Svg'; export default memo(() => { return <Svg vector='close' />; });
viniciusflv/gatsby-ts
src/components/Lang/hooks.ts
<reponame>viniciusflv/gatsby-ts import { useEffect, useState } from 'react'; import { changeLocale } from 'gatsby-plugin-intl'; import { LoadPageSync } from '../../../gatsby-api'; export function useHooks(loadPageSync: LoadPageSync) { const initialLocale = 'en'; const [locale, setLocale] = useState<string>(); ...
viniciusflv/gatsby-ts
src/components/Core/Container/interface.ts
<filename>src/components/Core/Container/interface.ts import { BaseProps } from '../Base/interface'; export interface Y<T> { top?: T; bottom?: T; } export interface X<T> { left?: T; right?: T; } export interface XY<T> extends X<T>, Y<T> {} export interface BorderRadius extends Y<X<string> | string> {} expor...
viniciusflv/gatsby-ts
src/components/Core/Paper/index.tsx
<reponame>viniciusflv/gatsby-ts export { PaperStyle as Paper } from './style';