repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
vumdao/cloudstructs
test/slack-events/slack-events.test.ts
<gh_stars>0 import { SecretValue, Stack } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; import { SlackEvents } from '../../src'; let stack: Stack; beforeEach(() => { stack = new Stack(); }); test('SlackEvents', () => { new SlackEvents(stack, 'SlackEvents', { signingSecret: SecretValue...
vumdao/cloudstructs
test/codecommit-mirror/codecommit-mirror.test.ts
import { Duration, Stack } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; import * as ecs from 'aws-cdk-lib/aws-ecs'; import * as events from 'aws-cdk-lib/aws-events'; import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; import { CodeCommitMirror, CodeCommitMirrorSourceRepository } ...
vumdao/cloudstructs
src/email-receiver/whitelist.lambda.ts
/* eslint-disable no-console */ export async function handler(event: AWSLambda.SESEvent): Promise<{ disposition: string }> { console.log('Event: %j', event); const sesNotification = event.Records[0].ses; if (!process.env.SOURCE_WHITELIST) { console.log('Missing SOURCE_WHITELIST'); return { disposition: ...
vumdao/cloudstructs
test/slack-app/handler.test.ts
<gh_stars>0 const getSecretValueResponseMock = jest.fn(); const getSecretValueMock = jest.fn().mockImplementation(() => ({ promise: getSecretValueResponseMock, })); const putSecretValueResponseMock = jest.fn().mockResolvedValue({}); const putSecretValueMock = jest.fn().mockImplementation(() => ({ promise: putSecre...
vumdao/cloudstructs
test/slack-textract/slack-textract.test.ts
import { SecretValue, Stack } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; import { SlackTextract } from '../../src'; let stack: Stack; beforeEach(() => { stack = new Stack(); }); test('SlackEvents', () => { new SlackTextract(stack, 'SlackTextract', { signingSecret: SecretValue.secre...
vumdao/cloudstructs
test/static-website/static-website.test.ts
<filename>test/static-website/static-website.test.ts<gh_stars>0 import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2-alpha'; import * as integrations from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; import { App, Stack } from 'aws-cdk-lib'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import * as route53 f...
vumdao/cloudstructs
src/slack-events/signature.ts
<reponame>vumdao/cloudstructs import * as crypto from 'crypto'; export interface VerifyRequestSignatureOptions { readonly body: string; readonly requestSignature: string; readonly requestTimestamp: number; readonly signingSecret: string; } export function verifyRequestSignature(options: VerifyRequestSignature...
vumdao/cloudstructs
src/url-shortener/shortener.lambda.ts
<gh_stars>10-100 /* eslint-disable no-console */ import { DynamoDB, S3 } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies function base62Encode(int: number): string { const characterSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; if (int === 0) return '0'; let s = ...
vumdao/cloudstructs
src/email-receiver/s3.lambda.ts
<filename>src/email-receiver/s3.lambda.ts /* eslint-disable no-console */ export async function handler(event: AWSLambda.SNSEvent): Promise<AWSLambda.SESMessage> { console.log('Event: %j', event); const message = JSON.parse(event.Records[0].Sns.Message) as AWSLambda.SESMessage; return message; }
vumdao/cloudstructs
test/ecs-service-roller/ecs-service-roller.test.ts
import { Duration, Stack } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; import * as ecs from 'aws-cdk-lib/aws-ecs'; import * as events from 'aws-cdk-lib/aws-events'; import { EcsServiceRoller, RollTrigger } from '../../src'; let stack: Stack; let cluster: ecs.ICluster; let service: ecs.IServi...
vumdao/cloudstructs
test/toolkit-cleaner/toolkit-cleaner.integ.ts
<gh_stars>0 import { App, Duration, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { ToolkitCleaner } from '../../src'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); new ToolkitCleaner(this, 'T...
vumdao/cloudstructs
src/state-machine-cr-provider/runtime/http.ts
import * as https from 'https'; import * as url from 'url'; export const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::StateMachineProvider::MISSING_PHYSICAL_ID'; interface CloudFormationResponse { StackId: string; RequestId: string; PhysicalResourceId?: string; LogicalResourceId: string; ResponseURL: string; Dat...
vumdao/cloudstructs
test/slack-app/slack-app.test.ts
import { Stack } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; import * as secrets from 'aws-cdk-lib/aws-secretsmanager'; import { SlackApp, SlackAppManifestDefinition } from '../../src'; let stack: Stack; beforeEach(() => { stack = new Stack(); }); test('SlackApp', () => { new SlackApp(s...
vumdao/cloudstructs
src/toolkit-cleaner/get-stack-names.lambda.ts
import { CloudFormation } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies const cloudFormation = new CloudFormation(); export async function handler() { const res: string[] = []; let nextToken: string | undefined; let finished = false; while (!finished) { const response = await c...
vumdao/cloudstructs
src/slack-events/index.ts
import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2-alpha'; import * as integrations from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; import * as cdk from 'aws-cdk-lib'; import * as events from 'aws-cdk-lib/aws-events'; import * as logs from 'aws-cdk-lib/aws-logs'; import { Construct } from 'constructs'; impor...
vumdao/cloudstructs
test/state-machine-cr-provider/state-machine-cr-provider.test.ts
<gh_stars>0 import { CustomResource, Stack } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; import { StateMachineCustomResourceProvider } from '../../src'; let stack: Stack; beforeEach(() => { stack = new Stack(); }); test('StateMachineCustomResourceProvider', () => { // WHEN const provi...
vumdao/cloudstructs
src/static-website/origin-request-handler/index.ts
<gh_stars>10-100 import * as path from 'path'; export async function handler(event: AWSLambda.CloudFrontRequestEvent): Promise<AWSLambda.CloudFrontRequest> { const request = event.Records[0].cf.request; if (!path.extname(request.uri)) request.uri = '/index.html'; return request; }
vumdao/cloudstructs
src/slack-textract/detect.lambda.ts
<reponame>vumdao/cloudstructs<gh_stars>10-100 /* eslint-disable no-console */ import { WebClient, WebAPICallResult } from '@slack/web-api'; import { Textract } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies import got from 'got'; export interface SlackEvent { channel_id: string; file_id: ...
paracs/ng2-Dashboard
src/modules/dashboard/dashboard.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { ApiService } from '../../services/api.service'; import { AppConfig } from '../../config/app.config'; import { ChartsModule } from...
paracs/ng2-Dashboard
src/modules/dashboard/components/mailbox/compose-mail.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'compose-mail', templateUrl: './view/compose.html' }) export class ComposeMailComponent { }
paracs/ng2-Dashboard
src/modules/dashboard/components/dashboard/header.component.ts
<filename>src/modules/dashboard/components/dashboard/header.component.ts import {Component} from '@angular/core'; import { Router } from "@angular/router"; import { AuthenticationService } from '../../../authentication/authentication.service'; @Component({ selector: 'dashboard-header', templateUrl : './view/h...
paracs/ng2-Dashboard
src/modules/dashboard/components/dashboard/right-sidebar.component.ts
import {Component} from '@angular/core'; import * as $ from 'jquery'; @Component({ selector: 'right-sidebar', templateUrl: './view/right-sidebar.html', styleUrls:['./styles/right-side-bar.css'] }) export class RightSidebarComponent{ public changeTheme(e:any):void{ console.log("dsdsd",$('body')...
paracs/ng2-Dashboard
src/modules/dashboard/dashboard-routing.module.ts
import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; //import { CanDeactivateGuard } from '../can-deactivate-guard.service'; import { AuthGuard } from '../../modules/authentication/auth-guard.service'; //import { PreloadSelectedModules } from '../selective-preload-strategy'...
paracs/ng2-Dashboard
src/modules/dashboard/components/time/time.component.ts
import { Component, Attribute } from '@angular/core'; @Component({ selector: 'live-time', templateUrl: './view/time.html', styleUrls:['./styles/time.css'] }) export class TimeComponent { private dateValue; constructor() { //set the date valaue this.dateValue = new Date(); ...
paracs/ng2-Dashboard
src/modules/dashboard/components/notifications/notification.component.ts
import { Component } from '@angular/core'; import { NotificationsService } from 'angular2-notifications'; import { NotificationConfig } from '../../../../config/notification.config'; @Component({ selector: 'notification', templateUrl: './view/simple-notification.html', providers: [NotificationsService, N...
paracs/ng2-Dashboard
src/modules/dashboard/components/carosuel/carosuel.component.ts
<reponame>paracs/ng2-Dashboard import { Component } from '@angular/core'; @Component({ selector: 'carousel', templateUrl: './view/carousel.html', styleUrls:['./styles/carousel.css'] }) export class CarouselComponent { }
paracs/ng2-Dashboard
src/modules/dashboard/components/notifications/ng2-toasty.component.ts
<filename>src/modules/dashboard/components/notifications/ng2-toasty.component.ts import {Component} from '@angular/core'; import {ToastyService, ToastyConfig, ToastOptions, ToastData} from 'ng2-toasty'; @Component({ selector: 'app', templateUrl : './view/toasty.html' }) export class ToastyComponent { cons...
paracs/ng2-Dashboard
src/modules/dashboard/components/mailbox/read-mail.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'read-mail', templateUrl: './view/read-mail.html' }) export class ReadMailComponent { }
paracs/ng2-Dashboard
src/modules/dashboard/components/chart/ng2-chart.component.ts
<reponame>paracs/ng2-Dashboard import { Component } from '@angular/core'; import 'chart.js/dist/Chart'; import { ChartService } from './chart.service'; @Component({ selector: 'ng2-chart', templateUrl: './view/ng2-chart.html', providers: [ChartService] }) export class Ng2ChartComponent { constructor(private c...
paracs/ng2-Dashboard
src/app.module.ts
<reponame>paracs/ng2-Dashboard<filename>src/app.module.ts<gh_stars>0 import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; import { AppRoutingModule } from ...
paracs/ng2-Dashboard
src/modules/dashboard/components/forms/form-general.component.ts
<gh_stars>0 import {Component} from '@angular/core'; @Component({ selector: 'form-general', templateUrl: './view/general.html' }) export class FormGeneralComponent { }
paracs/ng2-Dashboard
src/modules/authentication/authentication.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { SimpleNotificationsModule } from 'angular2-notifications'; import { ApiService } from '../../services/api.service'; import { AuthenticationService } from './authe...
paracs/ng2-Dashboard
src/modules/dashboard/components/chart/highchart-weather.component.ts
<reponame>paracs/ng2-Dashboard import { Component } from '@angular/core'; import { ChartService } from './chart.service'; @Component({ selector: 'high-chart-weather', templateUrl: './view/high-chart-weather.html', styleUrls: ['./styles/high-chart.css'], providers: [ChartService] }) export class HighCh...
paracs/ng2-Dashboard
src/config/app.config.ts
export class AppConfig { public appTitle:string = "ng2-Dashboard"; public lang:string = "en"; public dateFormat: string = "mm/dd/yy"; public apiBase:string = "json/"; public theme: string = "skin-purple"; public layout: string = "sidebar-mini"; public googl...
paracs/ng2-Dashboard
src/modules/dashboard/components/drag&drop/drag-and-drop.component.ts
<filename>src/modules/dashboard/components/drag&drop/drag-and-drop.component.ts import { Component } from '@angular/core'; import { DragulaService } from 'ng2-dragula/ng2-dragula'; @Component({ selector: 'drag-and-drop', templateUrl: './view/drag-and-drop.html', providers: [DragulaService], styleUrls: ...
paracs/ng2-Dashboard
src/modules/dashboard/components/maps/leaflet-map.component.ts
<gh_stars>0 import { Component } from '@angular/core'; import { CandTLeafletService } from 'angular2.leaflet.components'; @Component({ selector: 'leafet-map', templateUrl: './view/leaflet-map.html', providers: [CandTLeafletService] }) export class LeafletMapComponent { public lat: number = 12.973425;...
paracs/ng2-Dashboard
src/modules/authentication/authentication-routing.module.ts
<gh_stars>0 import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AuthGuard } from './auth-guard.service'; import { AuthenticationService } from './authentication.service'; import { LoginComponent } from './components/login.component'; const Authen...
paracs/ng2-Dashboard
src/modules/dashboard/components/forms/form-advanced.component.ts
import {Component} from '@angular/core'; @Component({ selector: 'form-advanced', templateUrl: './view/advanced.html' }) export class FormAdvancedComponent { }
paracs/ng2-Dashboard
src/modules/authentication/components/login.component.ts
<filename>src/modules/authentication/components/login.component.ts import { Component } from '@angular/core'; import { Router } from '@angular/router'; import { NotificationsService } from 'angular2-notifications'; import { AuthenticationService } from '../authentication.service'; @Component({ selector: 'login',...
paracs/ng2-Dashboard
src/modules/dashboard/components/maps/leaflet-weather.component.ts
import { Component } from '@angular/core'; import { CandTLeafletService } from 'angular2.leaflet.components'; @Component({ selector:'leaflet-weather', templateUrl:'./view/leaflet-weather.html', providers:[CandTLeafletService] }) export class LeafletWeatherComponent { public lat: number = 12.973425; ...
paracs/ng2-Dashboard
src/modules/authentication/authentication.service.ts
import { Injectable } from '@angular/core'; import { ApiService } from '../../services/api.service'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/do'; import 'rxjs/add/operator/delay'; @Injectable() export class AuthenticationService { protected authEnd...
paracs/ng2-Dashboard
src/config/menu.config.ts
export class MenuConfig { //Add slimscroll to navbar menus //This requires you to load the slimscroll plugin //in every page before app.js public navbarMenuSlimscroll: boolean = true; public navbarMenuSlimscrollWidth:string = "3px"; //The width of the scroll bar publicnavbarMenuHeight: string =...
paracs/ng2-Dashboard
src/config/notification.config.ts
export class NotificationConfig { public position: string[] = ["bottom", "right"]; public timeOut: number = 5000; public showProgressBar: boolean = true; public pauseOnHover: boolean = true; public clickToClose: boolean = true; public maxLength: number = 10; }
paracs/ng2-Dashboard
src/modules/dashboard/components/maps/google-map.component.ts
import { Component } from '@angular/core'; // just an interface for type safety. interface marker { lat: number; lng: number; label?: string; draggable: boolean; color?: string; } @Component({ selector: 'google-map', templateUrl: './view/google-map.html', styleUrls: ['./styles/google-...
paracs/ng2-Dashboard
src/services/api.service.ts
import { Injectable } from '@angular/core'; import { Headers, Http, URLSearchParams } from '@angular/http'; import { AppConfig } from '../config/app.config'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/toPromise'; @Injectable() export class ApiService { private apiBase = new AppConfig...
paracs/ng2-Dashboard
src/modules/dashboard/components/home/home.component.ts
import { Component } from '@angular/core'; import { HomeService } from './home.service'; import { TimeComponent } from '../../components/time/time.component'; @Component({ selector: 'home', templateUrl: './view/home.html', styleUrls:['./styles/home.css'], providers: [HomeService] }) export class HomeC...
paracs/ng2-Dashboard
src/modules/dashboard/components/chart/ng2-google-chart.component.ts
<gh_stars>0 import { Component } from '@angular/core'; @Component({ selector: 'ng2-google-chart', templateUrl: './view/google-chart.html' }) export class GoogleChartComponent { //bar or column chart options columnChartOptions = { chartType: 'ColumnChart', dataTable: [ ['Country', 'Performance',...
paracs/ng2-Dashboard
src/modules/dashboard/components/dashboard/dashboard.component.ts
//import import {Component} from '@angular/core'; import { MenuConfig } from '../../../../config/menu.config'; import * as $ from 'jquery'; import 'bootstrap/dist/js/bootstrap'; @Component({ selector:'dashboard', templateUrl:'./view/dashboard.html', }) export class DashBoardComponent { public options:...
paracs/ng2-Dashboard
src/modules/dashboard/components/home/home.service.ts
import { Injectable } from '@angular/core'; import { URLSearchParams } from '@angular/http'; import { ApiService } from '../../../../services/api.service'; import { AppConfig } from '../../../../config/app.config'; import 'rxjs/add/operator/toPromise'; @Injectable() export class HomeService { constructor(privat...
paracs/ng2-Dashboard
src/modules/dashboard/components/chart/chart.service.ts
<reponame>paracs/ng2-Dashboard import { Injectable } from '@angular/core'; import { URLSearchParams } from '@angular/http'; import { ApiService } from '../../../../services/api.service'; import 'rxjs/add/operator/toPromise'; @Injectable() export class ChartService { constructor(private apiService: ApiService) {...
paracs/ng2-Dashboard
src/modules/dashboard/components/forms/form-editors.component.ts
<reponame>paracs/ng2-Dashboard import {Component} from '@angular/core'; @Component({ selector: 'form-editors', templateUrl: './view/editors.html' }) export class FormEditorsComponent { }
Kosmos-Community/desma
src/components/atoms/FontContainer.tsx
import { Container } from '@nextui-org/react'; import React from 'react'; const FontContainer = ({ headingFontName, children, fontWeight }) => { return ( <Container css={{ m: 0, p: 0, width: 'fit-content', maxWidth: '520px', lineHeight: '2.25rem', overflowWra...
Kosmos-Community/desma
pages/dashboard/index.tsx
import React, { useEffect } from 'react'; import { Button, Container, Link, Spacer, Text } from '@nextui-org/react'; import { withIronSessionSsr } from 'iron-session/next'; import ProjectCard from '../../src/components/molecules/ProjectCard'; import AppLayout from '../../src/components/templates/AppLayout'; import { i...
Kosmos-Community/desma
src/components/templates/AppLayout.tsx
import React from 'react'; import { Container } from '@nextui-org/react'; import Nav from '../organisms/Nav'; const AppLayout = ({ children }) => { return ( <Container lg css={{ padding: 0 }}> <Nav /> <Container>{children}</Container> </Container> ); }; export default AppLayout;
Kosmos-Community/desma
src/utils/constants.ts
import { EScaleFactor } from '../context/DesignContext'; // TABLE HEADERS export const SCALE_OPTIONS: EScaleFactor[] = [ EScaleFactor.GOLDEN_RATIO, EScaleFactor.MAJOR_SECOND, EScaleFactor.MINOR_SECOND, EScaleFactor.MINOR_THIRD, EScaleFactor.MAJOR_THIRD, ]; export const TABLE_HEADERS = ['Name', 'Space', 'Pix...
Kosmos-Community/desma
src/components/atoms/Dropdown.tsx
<filename>src/components/atoms/Dropdown.tsx<gh_stars>10-100 import React from 'react'; import { Container, Spacer, Text } from '@nextui-org/react'; interface IDropdown { options: string[]; label: string; placeholder: string; value?: string; onChange?: (e: any) => void; } const Dropdown = ({ options, label, ...
Kosmos-Community/desma
src/theme/styles.tsx
import { globalCss, keyframes } from '@nextui-org/react'; const slideIn = keyframes({ '0%': { transform: 'translateY(0)' }, '100%': { transform: 'translateY(-2px)' }, }); export const globalStyles = globalCss({ '*': { margin: 0, padding: 0, boxSizing: 'border-box' }, select: { padding: '0.625rem 24px 0.62...
Kosmos-Community/desma
pages/share.tsx
import Preview from '../src/components/organisms/Preview'; const ShareScreen = () => { return <Preview />; }; export default ShareScreen;
Kosmos-Community/desma
pages/auth/register.tsx
import { Container, Input, Button, Text, Link, Spacer, Loading } from '@nextui-org/react'; import { withIronSessionSsr } from 'iron-session/next'; import { useRouter } from 'next/router'; import { useState } from 'react'; import validator from 'validator'; import { serverSidePropsAuth } from '../../lib/authServerSide';...
Kosmos-Community/desma
src/context/DesignContext.tsx
<filename>src/context/DesignContext.tsx import { createContext, useContext } from 'react'; import { ICollection, IDesign } from '../interfaces/IDesign'; import { FONT, PALLETTE, SPACING } from '../__mocks__/designMocks'; export enum EScaleFactor { MINOR_SECOND = 'Minor Second', MAJOR_SECOND = 'Major Second', MIN...
Kosmos-Community/desma
src/components/atoms/TabPanels.tsx
import { ITabChild } from '../../interfaces/ITabs'; import useTabsContext from '../../context/TabsContext'; export const TabPanels = ({ children }: ITabChild) => { const { tabState } = useTabsContext(); const panelArray = children instanceof Array ? children : [children]; if (panelArray.length <= 0) return <></...
Kosmos-Community/desma
src/components/molecules/Table.tsx
import React from 'react'; import { Grid } from '@nextui-org/react'; import { TableItem } from '../atoms/TableItem'; interface ITable { tableHeaders: string[]; tableRows: any[]; lastItemStyles?: any; } const Table = ({ tableHeaders, tableRows, lastItemStyles }: ITable) => { return ( <Grid.Container gap={0...
Kosmos-Community/desma
pages/designer/[designer_id].tsx
<gh_stars>10-100 import React, { useEffect, useReducer, useState } from 'react'; import { Button, Input, Loading, Modal, Row, Spacer, Text } from '@nextui-org/react'; import { Tab } from '../../src/components/atoms/Tab'; import { TabList } from '../../src/components/atoms/TabList'; import { TabPanel } from '../../src/c...
Kosmos-Community/desma
src/components/molecules/ProjectCard.tsx
import { Card, Row, Text, Link } from '@nextui-org/react'; import React from 'react'; interface IProjectCard { name: string; projectID: string; seed: string; } const ProjectCard = ({ name, projectID, seed }: IProjectCard) => { return ( <Link href={`designer/${projectID}`} css={{ maxWidth: '260px' }}> ...
Kosmos-Community/desma
src/components/organisms/ColorSection.tsx
<filename>src/components/organisms/ColorSection.tsx import React, { useEffect, useState } from 'react'; import { Container } from '@nextui-org/react'; import ColorCollection from '../molecules/ColorCollection'; import ColorPicker from '../molecules/ColorPicker'; import useDesignContext, { EDesignAction } from '../../c...
Kosmos-Community/desma
src/components/organisms/FontSection.tsx
import React, { useEffect, useState } from 'react'; import { Button, Grid, Input, Row, Spacer, Text } from '@nextui-org/react'; import useDesignContext, { EDesignAction } from '../../context/DesignContext'; import Dropdown from '../atoms/Dropdown'; import { GOOGLE_FONTS_URL, SCALE_OPTIONS, TABLE_HEADERS, WEIGHT...
Kosmos-Community/desma
src/components/molecules/Feature.tsx
import { Card, Spacer, Text } from '@nextui-org/react'; const Feature = ({ tag, title, desc }) => { return ( <Card color="primary" css={{ padding: '.5rem' }}> <Text h6 size={14} color="$blue200"> {tag} </Text> <Text h5 size={24} color="white"> {title} </Text> <Spacer...
Kosmos-Community/desma
pages/index.tsx
<gh_stars>10-100 import { Grid, Spacer, Text } from '@nextui-org/react'; import AppLayout from '../src/components/templates/AppLayout'; import Feature from '../src/components/molecules/Feature'; import { withIronSessionSsr } from 'iron-session/next'; import { serverSideProps } from '../lib/authServerSide'; import { iro...
Kosmos-Community/desma
pages/api/logout.ts
import { withIronSessionApiRoute } from 'iron-session/next'; import { ironOptions } from '../../lib/config'; function logoutRoute(req, res) { req.session.destroy(); res.send({ ok: true }); } export default withIronSessionApiRoute(logoutRoute, ironOptions);
Kosmos-Community/desma
src/context/TabsContext.tsx
<filename>src/context/TabsContext.tsx import { createContext, Dispatch, SetStateAction, useContext } from 'react'; interface ITabs { tabState?: number; setTabState?: Dispatch<SetStateAction<number>>; } const TabsContext = createContext<ITabs>({}); export const Tabs = TabsContext.Provider; const useTabsContext =...
Kosmos-Community/desma
src/utils/scaleFactor.tsx
<filename>src/utils/scaleFactor.tsx<gh_stars>10-100 import { Progress, Text } from '@nextui-org/react'; import { EScaleFactor } from '../context/DesignContext'; export const SCALES = { [EScaleFactor.GOLDEN_RATIO]: 1.618, [EScaleFactor.MAJOR_SECOND]: 1.125, [EScaleFactor.MAJOR_THIRD]: 1.25, [EScaleFactor.MINOR_...
Kosmos-Community/desma
pages/api/auth.ts
import { withIronSessionApiRoute } from 'iron-session/next'; import { ironOptions } from '../../lib/config'; import { AUTH_URL } from '../../src/utils/constants'; async function loginRoute(req, res) { // get user from database then: if (req.method === 'POST') { const response = await fetch(AUTH_URL, { me...
Kosmos-Community/desma
pages/_app.tsx
<reponame>Kosmos-Community/desma import { NextUIProvider } from '@nextui-org/react'; import { globalStyles } from '../src/theme/styles'; import { UserProvider } from '../src/context/UserContext'; import { IUser } from '../src/interfaces/IUser'; import { useState } from 'react'; const App = ({ Component, pageProps }) =...
Kosmos-Community/desma
src/components/atoms/TabList.tsx
import { cloneElement, Fragment } from 'react'; import { Container } from '@nextui-org/react'; import { ITabChild } from '../../interfaces/ITabs'; export const TabList = ({ children }: ITabChild) => { const panels = children instanceof Array ? children : [children]; return ( <Container css={{ wi...
Kosmos-Community/desma
src/components/atoms/ColorCard.tsx
<reponame>Kosmos-Community/desma import React from 'react'; import { Card, Row, Text } from '@nextui-org/react'; import { IColor } from '../../interfaces/IDesign'; import { HiOutlinePlusCircle } from 'react-icons/hi'; const ColorCard = ({ hexCode, rgbCode }: IColor) => { const isColorCard = Boolean(hexCode); ret...
Kosmos-Community/desma
src/__mocks__/designMocks.ts
<gh_stars>10-100 import { IFonts, IPallette, ISpacing } from '../interfaces/IDesign'; export enum EScaleFactor { MINOR_SECOND = 'Minor Second', MAJOR_SECOND = 'Major Second', MINOR_THIRD = 'Minor Third', MAJOR_THIRD = 'Major Third', GOLDEN_RATIO = 'Golden Ratio', } export const PALLETTE: IPallette = { pri...
Kosmos-Community/desma
src/components/organisms/Preview.tsx
<filename>src/components/organisms/Preview.tsx import { Container, Card, Spacer, Text, Button } from '@nextui-org/react'; import useDesignContext from '../../context/DesignContext'; import { SCALES } from '../../utils/scaleFactor'; const Preview = () => { const { designData } = useDesignContext(); return ( <C...
Kosmos-Community/desma
pages/auth/login.tsx
<reponame>Kosmos-Community/desma import { useState } from 'react'; import { useRouter } from 'next/router'; import { Container, Input, Button, Text, Link, Spacer, Loading } from '@nextui-org/react'; import validator from 'validator'; import { withIronSessionSsr } from 'iron-session/next'; import { ironOptions } from '....
Kosmos-Community/desma
src/components/atoms/TabPanel.tsx
import { Container } from '@nextui-org/react'; export const TabPanel = ({ children, ...props }) => { return ( <Container css={{ padding: 0, display: 'flex' }} {...props}> {children} </Container> ); };
Kosmos-Community/desma
src/interfaces/IDesign.ts
<gh_stars>10-100 import { Dispatch } from 'react'; import { EDesignAction, EScaleFactor } from '../context/DesignContext'; import { FONT, PALLETTE } from '../__mocks__/designMocks'; export interface IColor { _id?: string; hexCode?: string; rgbCode?: string; } export interface IPallette { primaryColor: IColor[...
Kosmos-Community/desma
src/context/UserContext.tsx
<gh_stars>10-100 import { createContext, Dispatch, SetStateAction, useContext } from 'react'; import { IUser } from '../interfaces/IUser'; interface IUserContext { userData: IUser; setUserData?: Dispatch<SetStateAction<IUser>>; } const UserContext = createContext<IUserContext>({ userData: { name: null, ...
Kosmos-Community/desma
src/components/organisms/Nav.tsx
import { Container, Text, Link, Button, Avatar, keyframes } from '@nextui-org/react'; import { useRouter } from 'next/router'; import { useState } from 'react'; import { HiHome, HiUserCircle, HiOutlineLogout } from 'react-icons/hi'; import useUserContext from '../../context/UserContext'; const Nav = () => { const ro...
Kosmos-Community/desma
src/utils/colorConversion.ts
<gh_stars>10-100 export const hexToRgb = (hex: string): string => { const hexRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if (!hexRegex) return null; const r = parseInt(hexRegex[1], 16); const g = parseInt(hexRegex[2], 16); const b = parseInt(hexRegex[3], 16); return `${r} ${g} ${b}`; }...
Kosmos-Community/desma
src/components/atoms/SpaceBox.tsx
<gh_stars>10-100 import { Container } from '@nextui-org/react'; export const SpaceBox = ({ size }: { size: number }) => { return ( <Container css={{ backgroundColor: '$black', width: size, height: 0, paddingTop: size, paddingLeft: 0, paddingRight: 0, ...
Kosmos-Community/desma
src/components/atoms/Tab.tsx
import { Button } from '@nextui-org/react'; import React, { ReactNode } from 'react'; import useTabsContext from '../../context/TabsContext'; interface ITab { index?: number; children?: ReactNode; } export const Tab = ({ index, children, ...props }: ITab) => { const { tabState, setTabState } = useTabsContext();...
Kosmos-Community/desma
src/components/molecules/ColorCollection.tsx
import React from 'react'; import { Card, Grid, Text } from '@nextui-org/react'; import { hexToRgb } from '../../utils/colorConversion'; import ColorCard from '../atoms/ColorCard'; import { IColor } from '../../interfaces/IDesign'; interface IColorCollection { color: string; paletteName: string; colors: IColor[...
Kosmos-Community/desma
lib/authServerSide.ts
<filename>lib/authServerSide.ts import { DESIGN_USERS_URL, DESIGN_URL, PALETTE_URL, FONT_URL, SPACING_URL, } from '../src/utils/constants'; export const serverSideProps = async ({ req }: any): Promise<any> => { const user = req.session.user || null; if (!user) return { props: { user: null } }; const i...
Kosmos-Community/desma
src/components/molecules/ColorPicker.tsx
import React from 'react'; import { Button, Card, Input, Spacer } from '@nextui-org/react'; import { HexColorPicker } from 'react-colorful'; const ColorPicker = ({ pickerState, color, setColor, addSectionColor, deleteColor }) => { const handleColorPicker = (e: React.ChangeEvent<HTMLInputElement>) => { if (e.targ...
Kosmos-Community/desma
src/components/atoms/TableItem.tsx
import { Grid } from '@nextui-org/react'; import { ReactNode } from 'react'; interface ITableItem { cellSize?: number; children: ReactNode; css?: any; } export const TableItem = ({ cellSize = 2, children, ...props }: ITableItem) => { return <Grid as="section" xs={cellSize} {...props}>{children}</Grid>; };
Kosmos-Community/desma
lib/config.ts
<gh_stars>10-100 const { NODE_ENV, IRON_COOKIE, IRON_PASSWORD } = process.env; export const ironOptions = { cookieName: IRON_COOKIE, password: <PASSWORD>, // secure: true should be used in production (HTTPS) but can't be used in development (HTTP) cookieOptions: { secure: NODE_ENV === 'production', }, };...
Kosmos-Community/desma
src/components/organisms/SpacingSection.tsx
<filename>src/components/organisms/SpacingSection.tsx import { Container, Input, Row, Spacer } from '@nextui-org/react'; import React, { useEffect, useState } from 'react'; import useDesignContext, { EDesignAction } from '../../context/DesignContext'; import { SCALE_OPTIONS, TABLE_HEADERS } from '../../utils/constants'...
luxor37/cookbook-vercel
src/@components/shared/undefinable/index.tsx
export default function Nullable({ children, obj }) { if (!obj) { return <></> } else { return <>{children}</> } }
luxor37/cookbook-vercel
src/@components/shared/recipe-card/index.tsx
import Lang from "../lang"; import imageUrlBuilder from '@sanity/image-url' import client from 'lib/sanity' import Link from 'next/link' import { useTranslation } from "next-i18next"; import Column from "../column"; import Row from "../row"; import Tags from "@/components/modules/tags"; import Clock from "../clock-svg"...
luxor37/cookbook-vercel
src/@components/modules/tags/index.tsx
import Lang from "../../shared/lang"; import Nullable from "../../shared/undefinable" export default function Tags({ tags }) { if (!tags) { return <></> } else { return ( <> {tags.map( ({ name }) => { return ( ...
luxor37/cookbook-vercel
src/@components/shared/clock-svg/index.tsx
<reponame>luxor37/cookbook-vercel export default function Clock() { return ( <svg xmlns="http://www.w3.org/2000/svg" className=" h-7 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9...
luxor37/cookbook-vercel
src/@components/shared/text-input/index.tsx
<gh_stars>0 import { IconProp } from "@fortawesome/fontawesome-svg-core"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { DetailedHTMLProps, InputHTMLAttributes, useState } from "react"; export interface TextInput extends Omit< DetailedHTMLProps< InputHTMLAttributes<HTMLInput...
luxor37/cookbook-vercel
src/@components/shared/column/index.tsx
import { ReactNode } from "react"; export interface Column { width: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; children: ReactNode; className?: string; noPadding?: boolean } export default function Column({ noPadding = false, width, children, className = "" }:Column) { //Width works like B...
luxor37/cookbook-vercel
src/@components/shared/nav/nav-button-lang/index.tsx
<filename>src/@components/shared/nav/nav-button-lang/index.tsx import { useRouter } from 'next/router' export default function NavButtonLang({ }) { const router = useRouter() const { pathname, asPath, query, locale } = router return ( <div className="cursor-pointer" onClick={() => {router.push({ pa...
luxor37/cookbook-vercel
src/pages/recipe/[recipe_id]/index.tsx
import Page from "@/components/shared/page"; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import React from "react"; import { getRecipeById, getRecipeIds } from 'lib/api' import Lang from "@/components/shared/lang"; import { useTranslation } from 'next-i18next'; import { useRouter } fro...
luxor37/cookbook-vercel
src/@components/shared/nav/nav-button-mobile/index.tsx
<filename>src/@components/shared/nav/nav-button-mobile/index.tsx export default function NavButtonMobile() { const showMenu = (e) => { document.querySelector("#button").classList.toggle("change"); document.querySelector(".nav-items").classList.toggle("max-h-96"); document.querySelector(".na...