Skip to content

Commit

Permalink
fixed font issues + glass effects + typos
Browse files Browse the repository at this point in the history
  • Loading branch information
amalcaraz committed Feb 16, 2023
1 parent 3b54374 commit 21f03f9
Show file tree
Hide file tree
Showing 12 changed files with 368 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<link
href="https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,400;1,400;1,700&family=Source+Code+Pro:wght@400;700&family=Rubik:ital,wght@0,500;1,800&display=swap"
rel="stylesheet">
4 changes: 2 additions & 2 deletions src/components/Button/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled, { css, DefaultTheme, FlattenSimpleInterpolation } from "styled-components"
import { getGlowMinCss } from "../../styles"
import { getGlowMinEffectCss } from "../../styles"
import { StyledButtonProps } from "./types"

const defaultVariants = (props: StyledButtonProps & { theme: DefaultTheme }) => {
Expand All @@ -8,7 +8,7 @@ const defaultVariants = (props: StyledButtonProps & { theme: DefaultTheme }) =>
const [g0, g1] = theme.gradient[color]?.colors || [color, color]

// @todo: Fix this
const glowMinCss = getGlowMinCss(color, { width: 192, height: 192 })
const glowMinCss = getGlowMinEffectCss(color, { width: 192, height: 192 })

if (kind === 'flat') {
switch (variant) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@ const defaultArgs: Partial<any> = {
const defaultParams = {
design: {
type: 'figma',
url: 'https://www.figma.com/file/OXq1C8cPtY3JtmwmGfD23I/ALEPH-rebranding-UIKIT?node-id=1%3A741&t=jFufZWoGIyZ8Gzf5-0',
url: 'https://www.figma.com/file/OXq1C8cPtY3JtmwmGfD23I/ALEPH-rebranding-UIKIT?node-id=1%3A115&t=OG6V4eRdvQIurCbK-0',
},
}

// ---

const Circle = styled.div`
width: 192px;
height: 192px;
font-size: 192px;
width: 160px;
height: 160px;
font-size: 160px;
border-radius: 50%;
margin: 10px 24px;
margin: 10px 12px;
display: inline-block;
`

const CatalogTemplate: ComponentStory<any> = (args) => {

const ColorsTemplate: ComponentStory<any> = (args) => {
return (
<>
<h1>Colors</h1>
Expand Down Expand Up @@ -60,36 +59,53 @@ const CatalogTemplate: ComponentStory<any> = (args) => {
<h1>Effects</h1>
<div>
<h3>Glow-MAX</h3>
<Circle className="bgg-main0 glow-max-main0"></Circle>
<Circle className="bgg-main1 glow-max-main1"></Circle>
<Circle className="bgg-main2 glow-max-main2"></Circle>
<Circle className="bgg-main0 fx-glow-max-main0"></Circle>
<Circle className="bgg-main1 fx-glow-max-main1"></Circle>
<Circle className="bgg-main2 fx-glow-max-main2"></Circle>
</div>
<div>
<h3>Glow-MAX-extras</h3>
<Circle className="bgg-extra0 glow-max-extra0"></Circle>
<Circle className="bgg-extra1 glow-max-extra1"></Circle>
<Circle className="bgg-extra0 fx-glow-max-extra0"></Circle>
<Circle className="bgg-extra1 fx-glow-max-extra1"></Circle>
</div>
<div>
<h3>Glow-MIN</h3>
<Circle className="bgg-main0 glow-min-main0"></Circle>
<Circle className="bgg-main1 glow-min-main1"></Circle>
<Circle className="bgg-main2 glow-min-main2"></Circle>
<Circle className="bgg-main0 fx-glow-min-main0"></Circle>
<Circle className="bgg-main1 fx-glow-min-main1"></Circle>
<Circle className="bgg-main2 fx-glow-min-main2"></Circle>
</div>
<div>
<h3>Glow-hover</h3>
<Circle className="bgg-main0 glow-hover-main0"></Circle>
<Circle className="bgg-main1 glow-hover-main1"></Circle>
<Circle className="bgg-main2 glow-hover-main2"></Circle>
<Circle className="bgg-main0 fx-glow-hover-main0"></Circle>
<Circle className="bgg-main1 fx-glow-hover-main1"></Circle>
<Circle className="bgg-main2 fx-glow-hover-main2"></Circle>
</div>
<div>
<h3>Glass</h3>
<Circle className="fx-glass-main0"></Circle>
<Circle className="fx-glass-main1"></Circle>
<Circle className="fx-glass-main2"></Circle>
<Circle className="fx-glass-base0"></Circle>
<Circle className="fx-glass-base1"></Circle>
<Circle className="fx-glass-base2"></Circle>
</div>
<div>
<h3>Glass-colored</h3>
<Circle className="fx-glass-colored0"></Circle>
</div>
<div>
<h3>dark-hover</h3>
<Circle className="fx-dark-main0"></Circle>
</div>
</>
)
};

export const Catalog = CatalogTemplate.bind({})
Catalog.args = {
export const Colors = ColorsTemplate.bind({})
Colors.args = {
...defaultArgs
};
Catalog.parameters = {
Colors.parameters = {
...defaultParams,
controls: { include: [], hideNoControlsWarning: true }
}
48 changes: 48 additions & 0 deletions src/components/_design/typo.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from "react";
import { ComponentStory, ComponentMeta } from "@storybook/react";
import { withDesign } from 'storybook-addon-designs'
import { StoryBookHeader, StoryBookSubheader } from "./utils";

export default {
title: "Design/Atoms/Typography",
decorators: [withDesign],
} as ComponentMeta<any>;

const defaultArgs: Partial<any> = {
}

const defaultParams = {
design: {
type: 'figma',
url: 'https://www.figma.com/file/OXq1C8cPtY3JtmwmGfD23I/ALEPH-rebranding-UIKIT?node-id=1%3A276&t=OG6V4eRdvQIurCbK-0',
},
}

// ---

const TypographyTemplate: ComponentStory<any> = (args) => {
return (
<>
<StoryBookHeader>Typography</StoryBookHeader>
<div>
<StoryBookSubheader>Headers</StoryBookSubheader>
<h1>H1 - Rubik - headers</h1>
<h2>H2 - Rubik - headers</h2>
<h3>H3 - Rubik - headers</h3>
<h4>H4 - Rubik - headers</h4>
<h5>H5 - Rubik - headers</h5>
<h6>H6 - Rubik - headers</h6>
<span className="typ-h7">H7 - Rubik - headers</span>
</div>
</>
)
};

export const Typography = TypographyTemplate.bind({})
Typography.args = {
...defaultArgs
};
Typography.parameters = {
...defaultParams,
controls: { include: [], hideNoControlsWarning: true }
}
20 changes: 20 additions & 0 deletions src/components/_design/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import styled from "styled-components";

export const StoryBookHeader = styled.h1`
display: inline-block;
font-family: 'Public Sans';
font-style: italic;
font-weight: 800;
font-size: 132px;
line-height: 155px;
color: #FFFFFF;
border-bottom: 2px solid white;
`

export const StoryBookSubheader = styled.h2`
font-family: 'Rubik';
font-style: italic;
font-weight: 600;
font-size: 48px;
line-height: 57px;
`
128 changes: 128 additions & 0 deletions src/styles/glass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { css, FlattenInterpolation } from "styled-components"
import { ThemeDarkEffect, ThemeGlassEffect } from "../themes/styles"
import { calculateBoxShadowPossition } from './glow'

export type GlassOpts = { width?: number, height?: number, offset?: boolean }

export function getGlassEffectCss(color: keyof ThemeGlassEffect, opts?: GlassOpts): FlattenInterpolation<any> | undefined {
return css`
${({ theme }) => {
if (color === 'main0' || color === 'main1' || color === 'main2') {
// inset 0 -82px 68px -64px #494DA966,
// inset 0 7px 11px -4px #FFFFFFE5,
// inset 0 39px 56px -36px #FFFFFF66,
// inset 0 1px 40px 0px #DEEFFF1A,
// inset 0 4px 18px 0px #5E9DD766,
// inset 0 98px 100px -48px #00D1FF2E;
const bs = {
s1: [0, -0.4271, 0.3542, -0.3333],
s2: [0, 0.0365, 0.0573, -0.0208],
s3: [0, 0.2031, 0.2917, -0.1875],
s4: [0, 0.0052, 0.2083, 0],
s5: [0, 0.0208, 0.0938, 0],
s6: [0, 0.5104, 0.5208, -0.25]
}
const bss = calculateBoxShadowPossition(bs, opts)
const c = theme.gradient[color].colors
const bg = `background-image: linear-gradient(90deg, ${c[0]}03 0%, ${c[1]}03 100%);`
switch (color) {
case 'main0':
return `
${bg}
box-shadow:
inset ${bss.s1} #494DA966,
inset ${bss.s2} #FFFFFFE5,
inset ${bss.s3} #FFFFFF66,
inset ${bss.s4} #DEEFFF1A,
inset ${bss.s5} #5E9DD766,
inset ${bss.s6} #00D1FF2E;
`
case 'main1':
return `
${bg}
box-shadow:
inset ${bss.s1} #4462904D,
inset ${bss.s2} #FFFFFF,
inset ${bss.s3} #FFFFFF80,
inset ${bss.s4} #DEFFF533,
inset ${bss.s5} #92D2AF4D,
inset ${bss.s6} #00FFBD2E;
`
case 'main2':
return `
${bg}
box-shadow:
inset ${bss.s1} #FF5C0017,
inset ${bss.s2} #FFFFFF,
inset ${bss.s3} #FFFFFF80,
inset ${bss.s4} #FFFCDE33,
inset ${bss.s5} #805B234D,
inset ${bss.s6} #F3FFC11A;
`
}
} else {
switch (color) {
case 'base0':
return `
border: 1px solid #FFFFFF1A;
background-image:
linear-gradient(91.23deg, #FFFFFF11 11.38%, #FFFFFF00 96.5%),
linear-gradient(84.86deg, #2260FF0C 65.23%, #1859FF00 99.89%),
linear-gradient(0deg, ${theme.color.background}, ${theme.color.background});
`
case 'base1':
return `
background-image:
linear-gradient(90.96deg, #1D1C3780 54.81%, #1D1C3700 103.58%);
`
case 'base2':
const bs = {
s1: [0, 0.0052, 0.2083, 0],
s2: [0, 0.0208, 0.0938, 0]
}
const bss = calculateBoxShadowPossition(bs, opts)
return `
background: ${theme.color.main0}03;
box-shadow:
inset ${bss.s1} #DEEFFF05,
inset ${bss.s2} #5E9DD705;
`
case 'colored0':
const c = theme.gradient.main0.colors
return `
border: 1px solid #FFFFFF1A;
background:
linear-gradient(91.23deg, #FFFFFF11 11.38%, #FFFFFF00 96.5%),
linear-gradient(342.74deg, #2D113A66 22.13%, #43125900 67.01%),
linear-gradient(107.53deg, ${c[0]}4D 16.25%, ${c[1]}4D 82.42%),
linear-gradient(0deg, ${theme.color.background}, ${theme.color.background});
`
}
}
}}
`
}

export function getDarkEffectCss(color: keyof ThemeDarkEffect, opts?: GlassOpts): FlattenInterpolation<any> | undefined {
const bs = {
s1: [0, 0.0052, 0.2604, 0]
}

const bss = calculateBoxShadowPossition(bs, opts)

return css`
${({ theme }) => {
return `
background-color: ${theme.color.main0}03;
box-shadow: ${bss.s1} #00000080;
`
}}
`
}
Loading

0 comments on commit 21f03f9

Please sign in to comment.