From d1f84084726234fa0542a3d6f9849510d6ebf61c Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Wed, 3 Jul 2019 01:04:59 +0300 Subject: [PATCH] Fix import paths in whole project --- src/assets/scss/_globals.scss | 66 ------------------- src/components/AsideSection/AsideSection.tsx | 3 +- src/components/ColorDiv/ColorDiv.scss | 65 ++++++++++++++++++ src/components/ColorDiv/ColorDiv.tsx | 41 +++++++++++- .../HeroAsideSection/HeroAsideSection.tsx | 3 +- src/components/MainSection/MainSection.tsx | 3 +- src/components/PageSection/PageSection.tsx | 3 +- src/components/SponsorReel/SponsorReel.tsx | 2 +- src/components/TextAnchor/TextAnchor.tsx | 3 +- src/index.tsx | 39 ----------- src/pages/ContactsPage/ContactsPage.tsx | 3 +- src/pages/FrontPage/FrontPage.tsx | 4 +- src/pages/GuildPage/GuildPage.tsx | 4 +- src/pages/SignUpPage/SignUpPage.tsx | 2 +- src/routes.tsx | 18 ++--- 15 files changed, 127 insertions(+), 132 deletions(-) diff --git a/src/assets/scss/_globals.scss b/src/assets/scss/_globals.scss index 4bcf2ef..4a6bcc8 100644 --- a/src/assets/scss/_globals.scss +++ b/src/assets/scss/_globals.scss @@ -37,69 +37,3 @@ $colors: ( @warn 'No specified hover color for '#{$label}'; add your own to _colors.scss'; @return lighten($color, 20%); } - - -.color-div { - @mixin hoverableColor($colorName) { - &__#{$colorName} { - color: color($colorName); - } - - &__#{$colorName}Hoverable { - &:hover, - &:active { - color: hover($colorName); - } - } - } - - @mixin backgroundColor($colorName) { - &__background_#{$colorName} { - background-color: color($colorName); - } - - &__background_#{$colorName}Hoverable { - &:hover, - &:active { - background-color: hover($colorName); - } - } - } - - @mixin backgroundAndHoverableColor($colorName) { - @include hoverableColor($colorName); - @include backgroundColor($colorName); - } - - @include backgroundAndHoverableColor(dark-blue); - @include backgroundAndHoverableColor(light-blue); - @include backgroundAndHoverableColor(white); - @include backgroundAndHoverableColor(black); - @include backgroundAndHoverableColor(grey1); - @include backgroundAndHoverableColor(grey2); - @include backgroundAndHoverableColor(orange1); - @include backgroundAndHoverableColor(orange2); - @include backgroundAndHoverableColor(blue); - @include backgroundAndHoverableColor(light-turquoise); - @include backgroundAndHoverableColor(green); - @include backgroundAndHoverableColor(sand); - - &__inherit { - color: inherit; - } - - &__transparent { - color: transparent; - } - - &__inheritHoverable { - &:hover, - &:active { - color: inherit; - } - } - - &__background_transparent { - background-color: transparent; - } -} diff --git a/src/components/AsideSection/AsideSection.tsx b/src/components/AsideSection/AsideSection.tsx index 6fe47fd..0ed377b 100644 --- a/src/components/AsideSection/AsideSection.tsx +++ b/src/components/AsideSection/AsideSection.tsx @@ -1,7 +1,6 @@ import * as React from "react"; import "./AsideSection.scss"; -import ColorDiv from "../ColorDiv"; -import { ColorDivProps } from "../ColorDiv/ColorDiv"; +import ColorDiv, { ColorDivProps } from "../ColorDiv/ColorDiv"; export interface AsideSectionProps { className?: string; diff --git a/src/components/ColorDiv/ColorDiv.scss b/src/components/ColorDiv/ColorDiv.scss index d74729b..ea7b98b 100644 --- a/src/components/ColorDiv/ColorDiv.scss +++ b/src/components/ColorDiv/ColorDiv.scss @@ -1 +1,66 @@ @import "../../assets/scss/globals"; + +.color-div { + @mixin hoverableColor($colorName) { + &__#{$colorName} { + color: color($colorName); + } + + &__#{$colorName}Hoverable { + &:hover, + &:active { + color: hover($colorName); + } + } + } + + @mixin backgroundColor($colorName) { + &__background_#{$colorName} { + background-color: color($colorName); + } + + &__background_#{$colorName}Hoverable { + &:hover, + &:active { + background-color: hover($colorName); + } + } + } + + @mixin backgroundAndHoverableColor($colorName) { + @include hoverableColor($colorName); + @include backgroundColor($colorName); + } + + @include backgroundAndHoverableColor(dark-blue); + @include backgroundAndHoverableColor(light-blue); + @include backgroundAndHoverableColor(white); + @include backgroundAndHoverableColor(black); + @include backgroundAndHoverableColor(grey1); + @include backgroundAndHoverableColor(grey2); + @include backgroundAndHoverableColor(orange1); + @include backgroundAndHoverableColor(orange2); + @include backgroundAndHoverableColor(blue); + @include backgroundAndHoverableColor(light-turquoise); + @include backgroundAndHoverableColor(green); + @include backgroundAndHoverableColor(sand); + + &__inherit { + color: inherit; + } + + &__transparent { + color: transparent; + } + + &__inheritHoverable { + &:hover, + &:active { + color: inherit; + } + } + + &__background_transparent { + background-color: transparent; + } +} \ No newline at end of file diff --git a/src/components/ColorDiv/ColorDiv.tsx b/src/components/ColorDiv/ColorDiv.tsx index fef9c18..de07fb3 100644 --- a/src/components/ColorDiv/ColorDiv.tsx +++ b/src/components/ColorDiv/ColorDiv.tsx @@ -1,6 +1,45 @@ import * as React from "react"; import "./ColorDiv.scss"; -import { ColorEnum, getColor, getBgColor, getHoverColor, getBgHoverColor } from "../.."; + +export enum ColorEnum { + DarkBlue, + LightBlue, + White, + Black, + Grey1, + Grey2, + Orange1, + Orange2, + Blue, + LightTurquoise, + Green, + Sand, + Transparent, + Inherit, +} + +const colors = new Map([ + [ColorEnum.DarkBlue, "dark-blue"], + [ColorEnum.LightBlue, "light-blue"], + [ColorEnum.White, "white"], + [ColorEnum.Black, "black"], + [ColorEnum.Grey1, "grey1"], + [ColorEnum.Grey2, "grey2"], + [ColorEnum.Orange1, "orange1"], + [ColorEnum.Orange2, "orange2"], + [ColorEnum.Blue, "blue"], + [ColorEnum.LightTurquoise, "light-turquoise"], + [ColorEnum.Green, "green"], + [ColorEnum.Sand, "sand"], + [ColorEnum.Transparent, "transparent"], + [ColorEnum.Inherit, "inherit"] +]); + +export const getColor = (color: ColorEnum): string => `color-div__${colors.get(color)}`; +export const getBgColor = (color: ColorEnum): string => `color-div__background_${colors.get(color)}`; +export const getHoverColor = (color: ColorEnum): string => `color-div__${colors.get(color)}Hoverable`; +export const getBgHoverColor = (color: ColorEnum): string => `color-div__background_${colors.get(color)}Hoverable`; + export interface ColorDivProps extends React.HTMLAttributes { textColor?: ColorEnum; diff --git a/src/components/HeroAsideSection/HeroAsideSection.tsx b/src/components/HeroAsideSection/HeroAsideSection.tsx index b60b5e7..3693afb 100644 --- a/src/components/HeroAsideSection/HeroAsideSection.tsx +++ b/src/components/HeroAsideSection/HeroAsideSection.tsx @@ -1,7 +1,6 @@ import * as React from "react"; import "./HeroAsideSection.scss"; -import ColorDiv from "../ColorDiv/index"; -import { ColorDivProps } from "../ColorDiv/ColorDiv"; +import ColorDiv, { ColorDivProps } from "../ColorDiv/ColorDiv"; export interface HeroAsideSectionProps { } diff --git a/src/components/MainSection/MainSection.tsx b/src/components/MainSection/MainSection.tsx index 16353c6..473a3e9 100644 --- a/src/components/MainSection/MainSection.tsx +++ b/src/components/MainSection/MainSection.tsx @@ -1,7 +1,6 @@ import * as React from "react"; import "./MainSection.scss"; -import ColorDiv from "../ColorDiv"; -import { ColorDivProps } from "../ColorDiv/ColorDiv"; +import ColorDiv, { ColorDivProps } from "../ColorDiv/ColorDiv"; export interface MainSectionProps { } export interface MainSectionState { } diff --git a/src/components/PageSection/PageSection.tsx b/src/components/PageSection/PageSection.tsx index d0d3cd9..fc7cb7c 100644 --- a/src/components/PageSection/PageSection.tsx +++ b/src/components/PageSection/PageSection.tsx @@ -1,7 +1,6 @@ import * as React from "react"; import "./PageSection.scss"; -import ColorDiv from "../ColorDiv/index"; -import { ColorDivProps } from "../ColorDiv/ColorDiv"; +import ColorDiv, { ColorDivProps } from "../ColorDiv/ColorDiv"; export interface PageSectionProps { center?: boolean; diff --git a/src/components/SponsorReel/SponsorReel.tsx b/src/components/SponsorReel/SponsorReel.tsx index d53b070..26d4f80 100644 --- a/src/components/SponsorReel/SponsorReel.tsx +++ b/src/components/SponsorReel/SponsorReel.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { Link } from "react-router-dom"; import "./SponsorReel.scss"; import TextAnchor from "../TextAnchor"; -import { ColorEnum } from "../.."; +import { ColorEnum } from "../ColorDiv/ColorDiv"; export interface SponsorReelProps { } export interface SponsorReelState { } diff --git a/src/components/TextAnchor/TextAnchor.tsx b/src/components/TextAnchor/TextAnchor.tsx index 3e7af14..d59e6df 100644 --- a/src/components/TextAnchor/TextAnchor.tsx +++ b/src/components/TextAnchor/TextAnchor.tsx @@ -1,7 +1,8 @@ import * as React from "react"; import "./TextAnchor.scss"; import { Link } from "react-router-dom"; -import { ColorEnum, getColor, getHoverColor } from "../.."; +import { ColorEnum, getColor, getHoverColor } from "../ColorDiv/ColorDiv"; + export enum TextSize { Small, diff --git a/src/index.tsx b/src/index.tsx index e892a87..5ce0b6b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -5,45 +5,6 @@ import { AppContainer } from "react-hot-loader"; import Routes from "./routes"; import "./index.scss"; -export enum ColorEnum { - DarkBlue, - LightBlue, - White, - Black, - Grey1, - Grey2, - Orange1, - Orange2, - Blue, - LightTurquoise, - Green, - Sand, - Transparent, - Inherit, -} - -const colors = new Map([ - [ColorEnum.DarkBlue, "dark-blue"], - [ColorEnum.LightBlue, "light-blue"], - [ColorEnum.White, "white"], - [ColorEnum.Black, "black"], - [ColorEnum.Grey1, "grey1"], - [ColorEnum.Grey2, "grey2"], - [ColorEnum.Orange1, "orange1"], - [ColorEnum.Orange2, "orange2"], - [ColorEnum.Blue, "blue"], - [ColorEnum.LightTurquoise, "light-turquoise"], - [ColorEnum.Green, "green"], - [ColorEnum.Sand, "sand"], - [ColorEnum.Transparent, "transparent"], - [ColorEnum.Inherit, "inherit"] -]); - -export const getColor = (color: ColorEnum): string => `color-div__${colors.get(color)}`; -export const getBgColor = (color: ColorEnum): string => `color-div__background_${colors.get(color)}`; -export const getHoverColor = (color: ColorEnum): string => `color-div__${colors.get(color)}Hoverable`; -export const getBgHoverColor = (color: ColorEnum): string => `color-div__background_${colors.get(color)}Hoverable`; - console.log("Using API URL: ", process.env.API_URL); const rootEl = document.getElementById("root"); diff --git a/src/pages/ContactsPage/ContactsPage.tsx b/src/pages/ContactsPage/ContactsPage.tsx index dd9333a..bb9005b 100644 --- a/src/pages/ContactsPage/ContactsPage.tsx +++ b/src/pages/ContactsPage/ContactsPage.tsx @@ -1,8 +1,7 @@ import * as React from "react"; import Helmet from "react-helmet"; import "./ContactsPage.scss"; - -import { ColorEnum } from "../.."; +import { ColorEnum } from "../../components/ColorDiv/ColorDiv"; import { StaticContext } from "../../server/StaticContext"; import PageLink from "../../components/PageLink/PageLink"; import Card from "../../components/Card"; diff --git a/src/pages/FrontPage/FrontPage.tsx b/src/pages/FrontPage/FrontPage.tsx index 86a91ff..e92cff9 100644 --- a/src/pages/FrontPage/FrontPage.tsx +++ b/src/pages/FrontPage/FrontPage.tsx @@ -9,7 +9,7 @@ import { StaticContext } from "../../server/StaticContext"; // @ts-ignore import * as BeerImage from "../../assets/img/beer.jpeg"; import PageSection from "../../components/PageSection"; -import { ColorEnum } from "../../index"; +import { ColorEnum } from "../../components/ColorDiv/ColorDiv"; import PageLink from "../../components/PageLink/PageLink"; import HeroMainSection from "../../components/HeroMainSection"; @@ -18,7 +18,7 @@ import Button, { ButtonType } from "../../components/Button"; import Ribbon from "../../components/Ribbon"; import SponsorReel from "../../components/SponsorReel"; import HeroAsideItem from "../../components/HeroAsideItem"; -import TextAnchor from "../../components/TextAnchor/index"; +import TextAnchor from "../../components/TextAnchor"; import { TextSize } from "../../components/TextAnchor/TextAnchor"; interface FrontPageProps { diff --git a/src/pages/GuildPage/GuildPage.tsx b/src/pages/GuildPage/GuildPage.tsx index c6e9832..612886a 100644 --- a/src/pages/GuildPage/GuildPage.tsx +++ b/src/pages/GuildPage/GuildPage.tsx @@ -10,9 +10,9 @@ import HeroAsideSection from "../../components/HeroAsideSection"; import HeroAsideItem from "../../components/HeroAsideItem"; import Ribbon from "../../components/Ribbon"; import InfoBox from "../../components/InfoBox"; -import { ColorEnum } from "../../index"; +import { ColorEnum } from "../../components/ColorDiv/ColorDiv"; import Accordion from "../../components/Accordion"; -import TextAnchor from "../../components/TextAnchor/index"; +import TextAnchor from "../../components/TextAnchor"; import { TextSize } from "../../components/TextAnchor/TextAnchor"; export interface GuildPageProps { } diff --git a/src/pages/SignUpPage/SignUpPage.tsx b/src/pages/SignUpPage/SignUpPage.tsx index 262925c..e3c33da 100644 --- a/src/pages/SignUpPage/SignUpPage.tsx +++ b/src/pages/SignUpPage/SignUpPage.tsx @@ -3,7 +3,7 @@ import Helmet from "react-helmet"; import "./SignUpPage.scss"; import { getForm, SignupForm } from "../../models/SignupForm"; import PageSection from "../../components/PageSection"; -import { ColorEnum } from "../../index"; +import { ColorEnum } from "../../components/ColorDiv/ColorDiv"; import { Question, optionTypes } from "../../components/SignupQuestionsWidget"; export interface SignUpPageProps { diff --git a/src/routes.tsx b/src/routes.tsx index 7177e90..46d5598 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -20,11 +20,11 @@ import ContactsPage from "./pages/ContactsPage"; import AdminSignupPage from "./pages/AdminSignupPage"; import SignupCreatePage from "./pages/SignupCreatePage"; import SignUpPage from "./pages/SignUpPage"; -import ActualPage from "./pages/ActualPage/index"; -import FreshmenPage from "./pages/FreshmenPage/FreshmenPage"; -import StudiesPage from "./pages/StudiesPage/index"; -import CorporatePage from "./pages/CorporatePage/CorporatePage"; -import InEnglishPage from "./pages/InEnglishPage/index"; +import ActualPage from "./pages/ActualPage"; +import FreshmenPage from "./pages/FreshmenPage"; +import StudiesPage from "./pages/StudiesPage"; +import CorporatePage from "./pages/CorporatePage"; +import InEnglishPage from "./pages/InEnglishPage"; const renderPage = (Page) => (props): JSX.Element => { return ; @@ -60,11 +60,11 @@ const adminRoutes = [ { path: "/admin/feed/create", page: FeedCreatePage }, { path: "/admin/feed/:id", page: FeedCreatePage }, { path: "/admin/events", page: AdminEventPage }, - { path: "/admin/events/create", page: EventCreatePage}, - { path: "/admin/events/:id", page: EventCreatePage}, + { path: "/admin/events/create", page: EventCreatePage }, + { path: "/admin/events/:id", page: EventCreatePage }, { path: "/admin/signups", page: AdminSignupPage }, - { path: "/admin/signups/create", page: SignupCreatePage}, - { path: "/admin/signups/:id", page: SignupCreatePage}, + { path: "/admin/signups/create", page: SignupCreatePage }, + { path: "/admin/signups/:id", page: SignupCreatePage }, { path: "/admin/logout", page: AdminLogoutPage }, { path: "/admin", page: AdminFrontPage }, ];