repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
larshp/abap-transmogrify | src/memory_file.ts |
export class MemoryFile {
private filename: string;
private raw: string;
constructor(filename: string, raw: string) {
this.raw = raw;
this.filename = filename;
}
public getRaw(): string {
return this.raw;
}
public getFilename(): string {
return this.filename;
}
} |
larshp/abap-transmogrify | src/objects/_aobject.ts | <filename>src/objects/_aobject.ts<gh_stars>1-10
import {IObject} from "./_iobject";
import {ObjectType} from "../object_types";
export abstract class AObject implements IObject {
private name: string;
private masterLanguage: string;
// does all objects have a description?
constructor(name: string) {
this.na... |
larshp/abap-transmogrify | src/object_types.ts | <filename>src/object_types.ts
export enum ObjectType {
CLAS,
DCLS,
DDLS,
DOMA,
DTEL,
FUGR,
INTF,
MSAG,
TABL,
XSLT,
} |
larshp/abap-transmogrify | src/objects/intf.ts | import {AObject} from "./_aobject";
import {ObjectType} from "../object_types";
export class INTF extends AObject {
public getType() {
return ObjectType.INTF;
}
} |
larshp/abap-transmogrify | src/formats.ts | export enum Format {
abapGit,
ADT,
gitCTS,
SAPLink,
HTML,
} |
larshp/abap-transmogrify | src/_ifile.ts | <reponame>larshp/abap-transmogrify<filename>src/_ifile.ts
export interface IFile {
getRaw(): string;
getFilename(): string;
} |
larshp/abap-transmogrify | test/abapgit/dtel.ts | import * as fs from "fs";
import {expect} from "chai";
import {Registry} from "../../src/registry";
import {MemoryFile} from "../../src/memory_file";
import {Format} from "../../src/formats";
function readFile(filename: string): MemoryFile {
const raw = fs.readFileSync(filename, "utf-8");
return new MemoryFile(fil... |
larshp/abap-transmogrify | src/formats/abapgit/doma.ts | import * as os from "os";
import * as xml from "../../xml";
import {IFile} from "../../_ifile";
import {IParser} from "../_iparser";
import {IObject} from "../../objects/_iobject";
import {DOMA} from "../../objects/";
import {IWriter} from "../_iwriter";
import {MemoryFile} from "../../memory_file";
import {ABAPGitHelp... |
larshp/abap-transmogrify | src/formats/html/doma.ts | import {IWriter} from "../_iwriter";
import {IObject} from "../../objects/_iobject";
import {IFile} from "../../_ifile";
import {MemoryFile} from "../../memory_file";
import {ObjectType} from "../../object_types";
import {DOMA} from "../../objects/doma";
export class HTMLDOMA implements IWriter {
public write(obj: I... |
larshp/abap-transmogrify | src/registry.ts | import {DOMA, DTEL} from "./objects/";
import {ABAPGit} from "./formats/abapgit";
import {IFile} from "./_ifile";
import {IObject} from "./objects/_iobject";
import {ObjectType} from "./object_types";
import {Format} from "./formats";
import {HTML} from "./formats/html";
import {IOutput} from "./formats/_ioutput";
exp... |
larshp/abap-transmogrify | src/formats/abapgit/dtel.ts | <gh_stars>1-10
import * as os from "os";
import * as xml from "../../xml";
import {IFile} from "../../_ifile";
import {IParser} from "../_iparser";
import {IObject} from "../../objects/_iobject";
import {DTEL} from "../../objects/";
import {IWriter} from "../_iwriter";
import {MemoryFile} from "../../memory_file";
impo... |
larshp/abap-transmogrify | src/formats/abapgit/index.ts | export {ABAPGitDOMA} from "./doma";
export {ABAPGitDTEL} from "./dtel"; |
larshp/abap-transmogrify | src/formats/abapgit.ts | import {IInput} from "./_iinput";
import {IFile} from "../_ifile";
import {ObjectType} from "../object_types";
import {IParser} from "./_iparser";
import * as abapGit from "./abapgit/";
import {IOutput} from "./_ioutput";
import {IObject} from "../objects/_iobject";
export class ABAPGit implements IInput, IOutput {
... |
larshp/abap-transmogrify | src/objects/_iobject.ts | <reponame>larshp/abap-transmogrify<gh_stars>1-10
import {ObjectType} from "../object_types";
export interface IObject {
getName(): string;
getType(): ObjectType;
getTypeAsString(): string;
} |
larshp/abap-transmogrify | src/formats/_iparser.ts | <filename>src/formats/_iparser.ts
import {IFile} from "../_ifile";
import {IObject} from "../objects/_iobject";
export interface IParser {
parse(file: IFile, object: IObject): void;
} |
larshp/abap-transmogrify | src/objects/tabl.ts | <reponame>larshp/abap-transmogrify<gh_stars>1-10
import {AObject} from "./_aobject";
import {ObjectType} from "../object_types";
export class TABL extends AObject {
public getType() {
return ObjectType.TABL;
}
} |
larshp/abap-transmogrify | src/formats/_iinput.ts | <gh_stars>1-10
import {IFile} from "../_ifile";
import {ObjectType} from "../object_types";
import {IParser} from "./_iparser";
export interface IInput {
check(file: IFile): {type: ObjectType, name: string} | undefined;
getParser(type: ObjectType): IParser;
} |
shayeLee/vscode | src/vs/editor/contrib/quickAccess/gotoSymbolQuickAccess.ts | <reponame>shayeLee/vscode
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*-------------------------------------... |
shayeLee/vscode | src/vs/platform/environment/common/environment.ts | <reponame>shayeLee/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.
*--------------------------... |
shayeLee/vscode | src/vs/workbench/test/browser/quickAccess.test.ts | <gh_stars>1-10
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*------------------------------------------------... |
shayeLee/vscode | src/vs/editor/contrib/quickAccess/quickAccess.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*---------------------------------------------------------------... |
shayeLee/vscode | src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolAccess.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.
*---------------------------------------------------... |
zaiats85/fanat-frontend-workspace | projects/fanat-frontend/src/app/developer/developer.component.ts | import { ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'app-developer',
templateUrl: './developer.component.html',
styleUrls: ['./developer.component.styl'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.Emulat... |
zaiats85/fanat-frontend-workspace | projects/fanat-frontend/src/app/developer/developer.component.spec.ts | import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DeveloperComponent } from './developer.component';
describe('DeveloperComponent', () => {
let component: DeveloperComponent;
let fixture: ComponentFixture<DeveloperComponent>;
beforeEach(async () => {
await TestBed.configureTesting... |
zaiats85/fanat-frontend-workspace | projects/fanat-frontend/src/app/developer/developer.module.ts | import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DeveloperComponent } from './developer.component';
@NgModule({
imports: [
CommonModule
],
exports: [
DeveloperComponent
],
declarations: [
DeveloperComponent
],
providers: []
})
export class De... |
Velua/eos-transit | plugin-dev/transit-dev-simple/src/TestScreen.tsx | import React, { Component } from 'react';
import WAL, { WalletProvider, Wallet, DiscoveryAccount, DiscoveryData } from 'eos-transit';
const { getWallets, getWalletProviders } = WAL.accessContext;
import { TestButton } from './ui/TestButton';
import { DebugButton } from './ui/DebugButton';
import { Toggle } from './ui/T... |
TTamosauskas/portfoliosauskas | src/@lekoarts/gatsby-theme-cara/elements/inner.tsx | /** @jsx jsx */
import React from "react"
import { jsx } from "theme-ui"
type InnerProps = {
className?: string
children?: React.ReactNode
}
const Inner = ({ className, children }: InnerProps) => (
<div className={className} sx={{ width: [`full`, `full`, `full`, `full`, `full`, `2/3`], textAlign: `left` }}>
... |
TTamosauskas/portfoliosauskas | src/@lekoarts/gatsby-theme-cara/elements/divider.tsx | <filename>src/@lekoarts/gatsby-theme-cara/elements/divider.tsx<gh_stars>1-10
import React from "react"
import { css } from "theme-ui"
import { ParallaxLayer } from "react-spring/renderprops-addons.cjs"
type DividerProps = {
speed: number
offset: number
children?: React.ReactNode
bg?: string
fill?: string
c... |
TTamosauskas/portfoliosauskas | src/@lekoarts/gatsby-theme-cara/components/footer.tsx | <reponame>TTamosauskas/portfoliosauskas<filename>src/@lekoarts/gatsby-theme-cara/components/footer.tsx<gh_stars>1-10
/** @jsx jsx */
import { Footer as ThemeFooter, Styled, Flex, useColorMode, jsx } from "theme-ui"
const Footer = () => {
const [colorMode, setColorMode] = useColorMode()
const isDark = colorMode ===... |
thelastklein/Financas-pessoais-com-React | dtmoney/src/components/summary/index.tsx | import arrowupimg from '../../assets/arrow-up.svg'
import arrowdownimg from '../../assets/arrow-down.svg'
import moneyimg from '../../assets/money.svg'
import { Container } from "./styles";
import { useTransactions } from '../../hooks/useTransactions';
export function Summary(){
const {transactions} = useTransa... |
joshuaauerbachwatson/nimbella-deployer | src/includer.ts | <filename>src/includer.ts
/*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
... |
joshuaauerbachwatson/nimbella-deployer | src/slice-reader.ts | <reponame>joshuaauerbachwatson/nimbella-deployer<gh_stars>0
/*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://ww... |
joshuaauerbachwatson/nimbella-deployer | src/login.ts | <reponame>joshuaauerbachwatson/nimbella-deployer
/*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.or... |
joshuaauerbachwatson/nimbella-deployer | src/runtimes.ts | import axios, { AxiosInstance } from 'axios'
import { getCredentials, authPersister } from './credentials'
import debug from 'debug'
const debug_log = debug('nim:deployer:runtimes')
export const API_ENDPOINT = '/api/v1'
const RuntimesCache: Record<string, RuntimesConfig> = {}
// Custom types for runtimes.json confi... |
joshuaauerbachwatson/nimbella-deployer | tests/unit/util.test.ts | <reponame>joshuaauerbachwatson/nimbella-deployer
import { validateDeployConfig, loadProjectConfig } from "../../src/util";
import { ProjectReader } from "../../src/deploy-struct";
import { RuntimesConfig } from "../../src/runtimes";
describe('test validation of deploy configuration', () => {
test('should validate em... |
joshuaauerbachwatson/nimbella-deployer | src/deploy-struct.ts | /*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
joshuaauerbachwatson/nimbella-deployer | tests/unit/deploy.test.ts | import { ActionSpec } from '../../src/deploy-struct'
import { calculateActionExec } from '../../src/deploy'
describe('test calculating action runtime kind property', () => {
test('should return runtime property as kind', () => {
const as: ActionSpec = {
name: 'test-action',
main: 'main',
binary... |
joshuaauerbachwatson/nimbella-deployer | src/api.ts | /*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
joshuaauerbachwatson/nimbella-deployer | src/web-local.ts | /*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
joshuaauerbachwatson/nimbella-deployer | tests/unit/runtimes.test.ts | <gh_stars>1-10
import { fromPlatform, API_ENDPOINT, RuntimesConfig, runtimeForFileExtension, isBinaryFileExtension, fileExtensionForRuntime, runtimeForZipMid, canonicalRuntime, isValidRuntime, defaultRuntime } from '../../src/runtimes'
import axios from 'axios'
import { mocked } from 'ts-jest/utils'
jest.mock('axios')... |
joshuaauerbachwatson/nimbella-deployer | src/deploy-to-bucket.ts | /*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
joshuaauerbachwatson/nimbella-deployer | src/file-reader.ts | /*
* Copyright (c) 2019 - present Nimbella Corp.
*
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
iMisty/vue3-element-template | src/store/appStore.ts | <filename>src/store/appStore.ts
/*
* @Author: Miya
* @Date: 2021-11-27 02:34:42
* @LastEditTime: 2022-04-15 21:05:53
* @LastEditors: Miya
* @Description: Test Pinia Store
* @FilePath: \vue3-element-template\src\store\appStore.ts
*/
import { defineStore } from 'pinia';
interface RouterData {
path: String;
na... |
iMisty/vue3-element-template | vite.config.ts | <reponame>iMisty/vue3-element-template
/*
* @Description: Vite Config
* @Version: 1.0
* @Author: Mirage
* @Date: 2021-11-26 10:33:44
* @LastEditors: Mirage
* @LastEditTime: 2022-03-23 10:36:55
*/
import { defineConfig } from 'vite';
import path from 'path';
import vue from '@vitejs/plugin-vue';
import Gzip from ... |
iMisty/vue3-element-template | src/mock/table.ts | <filename>src/mock/table.ts<gh_stars>0
/*
* @Author: Miya
* @Date: 2022-01-04 23:40:09
* @LastEditTime: 2022-01-05 00:16:42
* @LastEditors: Miya
* @Description: Mock Data - Table
* @FilePath: \vue3-element-template\src\mock\table.ts
*/
export const MockTableData = [
{
id: 1,
title: 'Sentence1',
au... |
iMisty/vue3-element-template | src/utils/validate.ts | /*
* @Author: Miya
* @Date: 2022-01-15 23:54:01
* @LastEditTime: 2022-01-16 00:25:53
* @LastEditors: Miya
* @Description: Validator
* @FilePath: \vue3-element-template\src\utils\validate.ts
*/
/**
* @description Validate IPv4 Address
* @param value IPv4 Address
* @returns {Boolean} Validate result
*/
const ... |
iMisty/vue3-element-template | src/mock/tree.ts | /*
* @Author: Miya
* @Date: 2022-01-10 22:32:33
* @LastEditTime: 2022-01-10 22:32:34
* @LastEditors: Miya
* @Description: Mock Tree Data
* @FilePath: \vue3-element-template\src\mock\tree.ts
*/
interface Tree {
label: String;
children?: Tree[];
}
export const MockTreeData: Tree[] = [
{
label: 'Level one... |
iMisty/vue3-element-template | src/router/router.ts | /*
* @Description: Router Main
* @Version: 1.0
* @Author: Mirage
* @Date: 2021-11-26 17:11:35
* @LastEditors: Miya
* @LastEditTime: 2022-04-15 21:06:09
*/
import { createRouter, createWebHistory, Router, useRouter } from 'vue-router';
import nprogress from 'nprogress';
import 'nprogress/nprogress.css';
import La... |
iMisty/vue3-element-template | src/utils/request.ts | <reponame>iMisty/vue3-element-template<gh_stars>0
/*
* @Author: Miya
* @Date: 2022-01-03 23:27:50
* @LastEditTime: 2022-03-04 17:31:50
* @LastEditors: Miya
* @Description: AJAX Methods
* @FilePath: \vue3-element-template\src\utils\request.ts
*/
import axios from 'axios';
import Qs from 'qs';
// create an axios ... |
iMisty/vue3-element-template | src/main.ts | <reponame>iMisty/vue3-element-template
/*
* @Description: Main Config
* @Version: 1.0
* @Author: Mirage
* @Date: 2021-11-26 10:33:44
* @LastEditors: Miya
* @LastEditTime: 2021-12-11 21:04:05
*/
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import Router from './router/router';
import Elem... |
ObEngine/ObEngine-VSCode | src/extension.ts | import * as vscode from 'vscode';
import { ObEngineConfigurationProvider } from './obengineConfigurationProvider';
const util = require('util');
function showObEngineWorkingDirectoryNotConfiguredWarning() {
vscode.window.showWarningMessage("ÖbEngine Working Directory not configured, please set it at obengine.workingD... |
ObEngine/ObEngine-VSCode | src/debugAdapter.ts | import { LuaDebugSession } from './lrdbDebug'
LuaDebugSession.run(LuaDebugSession)
|
zapdos26/slack-poll | src/Actions.ts | <reponame>zapdos26/slack-poll<filename>src/Actions.ts
import { Poll } from "./Poll";
import { WebClient, WebAPICallResult } from "@slack/web-api";
import { KnownBlock } from "@slack/types";
import { Request, Response } from "express";
export class Actions {
public static readonly BUTTON_ACTION = "button";
publ... |
zapdos26/slack-poll | src/Static.ts | <gh_stars>0
import {
SectionBlock, ContextBlock, PlainTextElement, Option
} from "@slack/types";
export class Static {
public static appendIfMatching(optionArray: string[], keyword: string, appendText: string): string {
return optionArray[0].toLowerCase() === keyword || optionArray[1].toLowerCase() ===... |
noah-witt/keybase-meme-chat | src/db.ts | <filename>src/db.ts<gh_stars>0
import { createSchema, Type, typedModel,ExtractDoc, ExtractProps } from 'ts-mongoose';
import mongoose from 'mongoose';
mongoose.connect(process.env.MONGO, {
useNewUrlParser: true,
useUnifiedTopology: true
});
const ConversationSchema = createSchema({
conversationId: Type.stri... |
noah-witt/keybase-meme-chat | src/index.ts | import * as dotenv from "dotenv";
dotenv.config();
import Bot from 'keybase-bot';
import * as dilbert from './dilbert';
import * as xkcd from './xkcd';
import * as db from './db';
import moment from 'moment-timezone';
const bot = new Bot();
dilbert.setBot(bot);
xkcd.setBot(bot);
async function init() {
await bot.i... |
noah-witt/keybase-meme-chat | src/xkcd.ts | <reponame>noah-witt/keybase-meme-chat
import * as tmp from 'tmp-promise';
import * as tiny from 'tiny-json-http';
import * as dl from 'image-downloader';
import { MsgSummary } from "keybase-bot/lib/types/chat1";
import Bot from 'keybase-bot';
import * as db from './db';
let bot: Bot;
export function setBot(b: Bot) {
... |
noah-witt/keybase-meme-chat | src/dilbert.ts | import * as dilbert from '@noahwitt/dilbertapi';
import * as tmp from 'tmp-promise';
import * as dl from 'image-downloader';
import { MsgSummary } from "keybase-bot/lib/types/chat1";
import Bot from 'keybase-bot';
import * as db from './db';
let bot: Bot;
export function setBot(b: Bot) {
bot = b;
}
export async fu... |
lucas-barbosa/frontend-challenge | foton-books/src/components/NewBookCard/index.tsx | <reponame>lucas-barbosa/frontend-challenge
import { CircleWaves, StatsIcon } from 'components/Icons';
import { OutlinedCircle, Rectangle, Triangle } from 'components/Symbols';
import Link from 'next/link';
import * as S from './styles';
export type NewBookCardProps = {
id: string;
title: string;
author?: string... |
lucas-barbosa/frontend-challenge | foton-books/src/pages/search.tsx | <reponame>lucas-barbosa/frontend-challenge
import { useRouter } from 'next/router';
import Search from 'templates/Search';
import { getBooksByName } from 'services/bookService';
import { useEffect, useRef } from 'react';
import { BookProps } from 'types/book';
import useInfiniteData from 'hooks/useInfiniteData';
impor... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/Book/index.tsx | <filename>foton-books/src/templates/Book/index.tsx
import { useRouter } from 'next/router';
import ReactHtmlParser from 'react-html-parser';
import BookActions from 'components/BookActions';
import Container from 'components/Container';
import { BackIcon } from 'components/Icons';
import { Circle, OutlinedCircle, Oval... |
lucas-barbosa/frontend-challenge | foton-books/src/components/ReviewCard/index.tsx | <gh_stars>0
import * as S from './styles';
export type ReviewCardProps = {
cover: string;
link: string;
};
const ReviewCard = ({ cover, link }: ReviewCardProps) => (
<S.Wrapper href={link}>
<S.Image src={cover} alt="review card" />
</S.Wrapper>
);
export default ReviewCard;
|
lucas-barbosa/frontend-challenge | foton-books/src/components/CurrentlyReadingCard/stories.tsx | <gh_stars>0
import { Story, Meta } from '@storybook/react/types-6-0';
import CurrentlyReadingCard, { CurrentlyReadingCardProps } from '.';
import mock from './mock';
export default {
title: 'CurrentlyReadingCard',
component: CurrentlyReadingCard,
args: { ...mock }
} as Meta;
export const Default: Story<Currentl... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/Book/test.tsx | <reponame>lucas-barbosa/frontend-challenge<gh_stars>0
import { screen } from '@testing-library/react';
import { renderWithTheme } from 'utils/helpers';
import Book from '.';
import props from './mock';
describe('<Book />', () => {
it('should render a cover, title, author, description and action menu', () => {
r... |
lucas-barbosa/frontend-challenge | foton-books/src/styles/global.ts | <filename>foton-books/src/styles/global.ts
import { createGlobalStyle, css } from 'styled-components';
import * as fonts from './fonts';
export default createGlobalStyle`
${fonts.SFProText}
${fonts.SFProDisplay}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-font-smoothing: antialia... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BookActions/stories.tsx | import { Story, Meta } from '@storybook/react/types-6-0';
import BookActions from '.';
export default {
title: 'BookActions',
component: BookActions
} as Meta;
export const Default: Story = (args) => <BookActions {...args} />;
|
lucas-barbosa/frontend-challenge | foton-books/src/components/SearchForm/index.tsx | import { useState } from 'react';
import { SearchIcon } from 'components/Icons';
import * as S from './styles';
type SearchFormProps = {
initialValue?: string;
onChange?: (value: string) => void;
};
const SearchForm = ({ initialValue = '', onChange }: SearchFormProps) => {
const [value, setValue] = useState(in... |
lucas-barbosa/frontend-challenge | foton-books/src/pages/book/[id].tsx | import { GetStaticProps } from 'next';
import { useRouter } from 'next/router';
import Book from 'templates/Book';
import { BookProps } from 'types/book';
import { getBookById } from 'services/bookService';
export default function Index(props: BookProps) {
const router = useRouter();
if (router.isFallback) retur... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BookActions/index.tsx | <filename>foton-books/src/components/BookActions/index.tsx
import { BookIcon, HeadphoneIcon, ShareIcon } from 'components/Icons';
import * as S from './styles';
const BookActions = () => (
<S.Wrapper>
<S.Button>
<BookIcon />
<span>Read</span>
</S.Button>
<S.Button>
<HeadphoneIcon />
... |
lucas-barbosa/frontend-challenge | foton-books/src/components/NewBooksSlider/index.tsx | <filename>foton-books/src/components/NewBooksSlider/index.tsx<gh_stars>0
import { useState } from 'react';
import SlickSlider, { Settings } from 'react-slick';
import NewBookCard, { NewBookCardProps } from 'components/NewBookCard';
import * as S from './styles';
type SliderProps = {
items: NewBookCardProps[];
};
c... |
lucas-barbosa/frontend-challenge | foton-books/src/components/NewBookCard/test.tsx | import { render, screen } from '@testing-library/react';
import { renderWithTheme } from 'utils/helpers';
import NewBookCard from '.';
import props from './mock';
describe('<NewBookCard />', () => {
it('should render the title, author, count and cover', () => {
renderWithTheme(<NewBookCard {...props} />);
... |
lucas-barbosa/frontend-challenge | foton-books/src/pages/index.tsx | import { GetStaticProps } from 'next';
import reviewMock from 'components/ReviewCard/mock';
import HomePage, { HomePageProps } from 'templates/Home';
import { getBookById, getNewestBooks } from 'services/bookService';
export default function Index(props: HomePageProps) {
return <HomePage {...props} />;
}
export co... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BookCard/index.tsx | import Link from 'next/link';
import * as S from './styles';
export type BookCardProps = {
id: string;
title: string;
author?: string;
cover?: string;
};
const BookCard = ({
id,
title,
cover = '/images/generic-cover.png',
author = 'unknown author'
}: BookCardProps) => (
<S.Wrapper>
<Link href={`... |
lucas-barbosa/frontend-challenge | foton-books/src/components/CurrentlyReadingCard/styles.ts | import styled, { css } from 'styled-components';
import * as Symbols from 'components/Symbols/styles';
export const Title = styled.h3`
cursor: pointer;
color: #2a2b26;
font-family: 'Playfair Display';
font-size: 1.25rem;
letter-spacing: 2px;
line-height: 1.35;
`;
export const Author = styled.div`
${({ t... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/Home/test.tsx | import 'match-media-mock';
import { screen } from '@testing-library/react';
import { renderWithTheme } from 'utils/helpers';
import newBookMock from 'components/NewBookCard/mock';
import readingMock from 'components/CurrentlyReadingCard/mock';
import reviewMock from 'components/ReviewCard/mock';
import HomePage from... |
lucas-barbosa/frontend-challenge | foton-books/src/hooks/useOnScreen.ts | <filename>foton-books/src/hooks/useOnScreen.ts
import { RefObject, useEffect, useState } from 'react';
const useOnScreen = (ref: RefObject<HTMLDivElement>) => {
const [onScreen, setOnScreen] = useState(false);
useEffect(() => {
const observer = new IntersectionObserver(
([entry]) => setOnScreen(entry.is... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BottomMenu/test.tsx | import { render, screen } from '@testing-library/react';
import { renderWithTheme } from 'utils/helpers';
import BottomMenu from '.';
describe('<BottomMenu />', () => {
it('should render a footer with home, libraries and profile buttons', () => {
renderWithTheme(<BottomMenu />);
expect(screen.getByRole('na... |
lucas-barbosa/frontend-challenge | foton-books/src/hooks/useInfiniteData.ts | <gh_stars>0
import { useSWRInfinite } from 'swr';
function useInfiniteData<T>(
fetcher: (key: string, index: number) => Promise<T[]>,
searchTerm: string
) {
const { data, error, size, setSize } = useSWRInfinite(
(index, previousPage) => {
if (previousPage && !previousPage.length) return null;
ret... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/NotFound/index.tsx | import Base from 'templates/Base';
import ErrorMessage from 'components/ErrorMessage';
import * as S from './styles';
const NotFoundPage = () => (
<Base>
<S.Wrapper>
<S.Title>Página não encontrada!</S.Title>
<S.Message>
Oh não, parece que a página que está procurando não existe! Volte e
... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BottomMenu/index.tsx | import Link from 'next/link';
import { useRouter } from 'next/router';
import { HomeIcon, LibraryIcon, ProfileIcon } from 'components/Icons';
import Container from 'components/Container';
import * as S from './styles';
const menuItems = [
{
link: '/',
title: 'Home',
icon: <HomeIcon title="home link" />... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/Search/index.tsx | import Loader from 'react-loader-spinner';
import { forwardRef } from 'react';
import Base from 'templates/Base';
import BookCard from 'components/BookCard';
import Grid from 'components/Grid';
import { BookProps } from 'types/book';
import * as S from './styles';
import Container from 'components/Container';
import ... |
lucas-barbosa/frontend-challenge | foton-books/src/components/CurrentlyReadingCard/index.tsx | <gh_stars>0
import { Circle, OutlinedCircle, Rectangle, Waves } from 'components/Symbols';
import * as S from './styles';
export type CurrentlyReadingCardProps = {
id: string;
title: string;
author?: string;
currentlyChapter?: number;
totalChapters: number;
cover?: string;
};
const CurrentlyReadingCard = ... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BookCard/test.tsx | <reponame>lucas-barbosa/frontend-challenge<gh_stars>0
import { screen } from '@testing-library/react';
import { renderWithTheme } from 'utils/helpers';
import BookCard from '.';
import props from './mock';
describe('<BookCard />', () => {
it('should render title, author and a image', () => {
renderWithTheme(<Bo... |
lucas-barbosa/frontend-challenge | foton-books/src/components/Symbols/styles.ts | <filename>foton-books/src/components/Symbols/styles.ts
import styled from 'styled-components';
export const OutlinedCircleWrapper = styled.svg``;
export const CircleWrapper = styled.svg``;
export const RectangleWrapper = styled.svg``;
export const TriangleWrapper = styled.svg``;
export const WavesWrapper = styled.svg`... |
lucas-barbosa/frontend-challenge | foton-books/src/components/NewBookCard/mock.ts | export default {
id: 'teste',
title: 'Hooked',
author: '<NAME>',
count: 120,
cover:
'http://books.google.com/books/content?id=dsz5AwAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api'
};
|
lucas-barbosa/frontend-challenge | foton-books/src/components/Container/index.tsx | <reponame>lucas-barbosa/frontend-challenge
import styled, { css } from 'styled-components';
const Container = styled.div`
${({ theme }) => css`
padding-left: ${theme.container.gutter};
padding-right: ${theme.container.gutter};
max-width: ${theme.container.breakpoint};
width: 100%;
margin: auto;
... |
lucas-barbosa/frontend-challenge | foton-books/src/components/ReviewCard/stories.tsx | import { Story, Meta } from '@storybook/react/types-6-0';
import ReviewCard, { ReviewCardProps } from '.';
import mock from './mock';
export default {
title: 'ReviewCard',
component: ReviewCard,
args: { ...mock }
} as Meta;
export const Default: Story<ReviewCardProps> = (args) => (
<ReviewCard {...args} />
);... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BookCard/mock.ts | export default {
id: '9QFiPwAACAAJ',
title: 'The Little Prince',
author: '<NAME>',
cover:
'http://books.google.com/books/content?id=9QFiPwAACAAJ&printsec=frontcover&img=1&zoom=1&imgtk=AFLRE71zbXsmzqRAEBmoYs6oVCrlFDQ1_3msdrOMGHRb16yBN6luEE5Ous0EL7YJ5Gjml6kKJyMSqa72i-D2W1Hp6bfpSaILrB_yfvLIWmY99ffXZvVqIkLy5Ly6... |
lucas-barbosa/frontend-challenge | foton-books/src/components/NewBookCard/stories.tsx | <filename>foton-books/src/components/NewBookCard/stories.tsx
import { Story, Meta } from '@storybook/react/types-6-0';
import NewBookCard, { NewBookCardProps } from '.';
import mock from './mock';
export default {
title: 'NewBookCard',
component: NewBookCard,
args: { ...mock }
} as Meta;
export const Default: S... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/Search/styles.ts | import styled, { css } from 'styled-components';
import * as BottomMenuStyles from 'components/BottomMenu/styles';
import * as SearchStyles from 'components/SearchForm/styles';
export const Wrapper = styled.main`
${({ theme }) => css`
${BottomMenuStyles.Wrapper} {
position: fixed;
bottom: 0;
z... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/Home/index.tsx | <reponame>lucas-barbosa/frontend-challenge
import Base from 'templates/Base';
import Container from 'components/Container';
import CurrentlyReadingCard, {
CurrentlyReadingCardProps
} from 'components/CurrentlyReadingCard';
import ErrorMessage from 'components/ErrorMessage';
import { NewBookCardProps } from 'compon... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/NotFound/styles.tsx | <reponame>lucas-barbosa/frontend-challenge<filename>foton-books/src/templates/NotFound/styles.tsx
import styled, { css } from 'styled-components';
export const Wrapper = styled.div`
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
max-width: 400px;
text-align: center;
... |
lucas-barbosa/frontend-challenge | foton-books/src/components/SearchForm/test.tsx | <reponame>lucas-barbosa/frontend-challenge<filename>foton-books/src/components/SearchForm/test.tsx
import { screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { renderWithTheme } from 'utils/helpers';
import SearchForm from '.';
describe('<SearchForm />', () =... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BookCard/stories.tsx | import { Story, Meta } from '@storybook/react/types-6-0';
import BookCard, { BookCardProps } from '.';
import bookMock from './mock';
export default {
title: 'BookCard',
component: BookCard,
args: { ...bookMock }
} as Meta;
export const Default: Story<BookCardProps> = (args) => <BookCard {...args} />;
|
lucas-barbosa/frontend-challenge | foton-books/src/hooks/useSearchQuery.ts | <filename>foton-books/src/hooks/useSearchQuery.ts<gh_stars>0
import { useCallback, useEffect, useMemo } from 'react';
import { useRouter } from 'next/router';
import { useQueryState } from 'next-usequerystate';
import debounce from 'lodash.debounce';
type callback = (value: string) => void;
type useSearchReponse = [st... |
lucas-barbosa/frontend-challenge | foton-books/src/components/CurrentlyReadingCard/mock.ts | <gh_stars>0
export default {
id: 'teste',
title: 'Originals',
author: '<NAME>',
currentlyChapter: 2,
totalChapters: 9,
cover:
'http://books.google.com/books/content?id=Cy86CQAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api'
};
|
lucas-barbosa/frontend-challenge | foton-books/src/pages/404.tsx | import NotFoundPage from 'templates/NotFound';
export default function Index() {
return <NotFoundPage />;
}
|
lucas-barbosa/frontend-challenge | foton-books/src/components/Symbols/index.tsx | <reponame>lucas-barbosa/frontend-challenge
import * as S from './styles';
export const Circle = (props: React.ComponentPropsWithoutRef<'svg'>) => (
<S.CircleWrapper
width="116"
height="116"
viewBox="0 0 116 116"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<circle cx="58"... |
lucas-barbosa/frontend-challenge | foton-books/src/templates/Home/styles.tsx | <reponame>lucas-barbosa/frontend-challenge
import styled, { css } from 'styled-components';
import { darken } from 'polished';
export const Title = styled.h1`
${({ theme }) => css`
align-items: center;
color: #54565a;
display: flex;
font-family: ${theme.font.types.display};
font-size: ${theme.fon... |
lucas-barbosa/frontend-challenge | foton-books/src/components/BookActions/styles.ts | import styled, { css } from 'styled-components';
export const Wrapper = styled.aside`
background: #ffffff;
box-shadow: 3px 3px 23px rgba(107, 103, 70, 0.125901);
border-radius: 2px;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
`;
export const Button = styled.button`
${... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.