From f4a9539d294d70f8979fef8a989a867b47f738c2 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 16 Jul 2019 19:44:35 +0300 Subject: [PATCH] PageLink use TextAnchor --- src/components/PageLink/PageLink.scss | 2 ++ src/components/PageLink/PageLink.tsx | 9 +++++---- src/components/TextAnchor/TextAnchor.scss | 16 ++++++++-------- src/components/TextAnchor/TextAnchor.tsx | 12 +++++++----- src/pages/FrontPage/FrontPage.tsx | 2 +- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/components/PageLink/PageLink.scss b/src/components/PageLink/PageLink.scss index d48c12e..1b69b08 100644 --- a/src/components/PageLink/PageLink.scss +++ b/src/components/PageLink/PageLink.scss @@ -25,5 +25,7 @@ color: color(dark-blue); margin-left: 1rem; display: flex; + text-decoration: none; + font-weight: normal; } } diff --git a/src/components/PageLink/PageLink.tsx b/src/components/PageLink/PageLink.tsx index 428bbdb..2f36d76 100644 --- a/src/components/PageLink/PageLink.tsx +++ b/src/components/PageLink/PageLink.tsx @@ -1,20 +1,21 @@ import * as React from "react"; -import { Link } from "react-router-dom"; import "./PageLink.scss"; +import TextAnchor from "../TextAnchor"; +import { TextSize } from "../TextAnchor/TextAnchor"; export interface PageLinkProps { to: string; desc: string; } -export interface PageLinkState {} +export interface PageLinkState { } class PageLink extends React.Component { render() { - const {to, desc} = this.props; + const { to, desc } = this.props; return (

{this.props.children}

- {desc} + {desc}
); } diff --git a/src/components/TextAnchor/TextAnchor.scss b/src/components/TextAnchor/TextAnchor.scss index f954b40..ad1d68d 100644 --- a/src/components/TextAnchor/TextAnchor.scss +++ b/src/components/TextAnchor/TextAnchor.scss @@ -4,15 +4,15 @@ text-decoration: underline; font-weight: 600; - &.no-weight { + &__no-weight { font-weight: 100; + } - &.small { - text-decoration: none; - margin: 0 1rem; - font-size: 0.8rem; - text-transform: uppercase; - margin-top: 10px; - } + &__small { + text-decoration: none; + margin: 0 1rem; + font-size: 0.8rem; + text-transform: uppercase; + margin-top: 10px; } } diff --git a/src/components/TextAnchor/TextAnchor.tsx b/src/components/TextAnchor/TextAnchor.tsx index d59e6df..23bf596 100644 --- a/src/components/TextAnchor/TextAnchor.tsx +++ b/src/components/TextAnchor/TextAnchor.tsx @@ -5,6 +5,7 @@ import { ColorEnum, getColor, getHoverColor } from "../ColorDiv/ColorDiv"; export enum TextSize { + Normal, Small, Large, Ribbon, @@ -12,10 +13,11 @@ export enum TextSize { } const sizes = new Map([ - [TextSize.Small, "sm"], - [TextSize.Large, "lg"], - [TextSize.SmallRibbon, "no-weight small"], - [TextSize.Ribbon, "no-weight"], + [TextSize.Normal, ""], + [TextSize.Small, "text-anchor__small"], + [TextSize.Large, "text-anchor__large"], + [TextSize.SmallRibbon, "text-anchor__no-weight text-anchor__small"], + [TextSize.Ribbon, "text-anchor__no-weight"], ]); export interface TextAnchorProps { @@ -32,7 +34,7 @@ class TextAnchor extends React.Component { const { children, size, to, style, textColor, hoverColor } = this.props; const classColor = textColor !== undefined ? getColor(textColor) : getColor(ColorEnum.DarkBlue); const classHoverColor = hoverColor !== undefined ? getHoverColor(hoverColor) : getHoverColor(ColorEnum.Blue); - const classSize = size !== undefined ? sizes.get(size) : sizes.get(TextSize.Small); + const classSize = size !== undefined ? sizes.get(size) : sizes.get(TextSize.Normal); const className = `text-anchor ${classSize} ${classColor} ${classHoverColor}`; if (to.startsWith("/")) { return ( diff --git a/src/pages/FrontPage/FrontPage.tsx b/src/pages/FrontPage/FrontPage.tsx index e92cff9..fa00eb1 100644 --- a/src/pages/FrontPage/FrontPage.tsx +++ b/src/pages/FrontPage/FrontPage.tsx @@ -190,7 +190,7 @@ class FrontPage extends React.Component { Lue tuoreimmat uutiset - + Kuvia tapahtumista