Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
feat: Remove calc in style (#228)
Browse files Browse the repository at this point in the history
* feat: Move button model to near the button component file

* chore: Format code

* feat: Remove calc in style

WIP

* chore: Update text, anchore-text, button component

Update those components responsibe
re-taro authored Sep 27, 2022
1 parent 37afb16 commit 8d1f6db
Showing 19 changed files with 57 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -3,9 +3,8 @@
exports[`(components) atoms/anchor > take snap shot 1`] = `
<div>
<a
class="css-vle9m6"
class="css-zld2jk"
href="#"
role="link"
tabindex="0"
>
This is test
17 changes: 15 additions & 2 deletions src/components/atoms/anchor-text/anchor-text.stories.tsx
Original file line number Diff line number Diff line change
@@ -6,13 +6,26 @@ type Story = ComponentStoryObj<T>;

const data = {
link: "#",
role: "link",
sentence: "This is test",
tabindex: 0,
};

export default {
args: { children: data.sentence, href: data.link, role: data.role, tabIndex: data.tabindex },
args: { children: data.sentence, href: data.link, tabIndex: data.tabindex },
argTypes: {
children: {
description: "Context of anchor",
control: {
type: "text",
},
},
href: {
description: "Link of anchor",
control: {
type: "text",
},
},
},
component: AnchorText,
} as ComponentMeta<T>;

2 changes: 1 addition & 1 deletion src/components/atoms/anchor-text/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tw from "twin.macro";

const AnchorText = tw.a`font-zen text-white text-[calc(12px + 4 * ((100vw - 378px) / 1134))]`;
const AnchorText = tw.a`font-zen text-xs sm:text-text text-base`;

export { AnchorText };
Original file line number Diff line number Diff line change
@@ -3,13 +3,13 @@
exports[`(components) atoms/button > take anchor button's snap shot 1`] = `
<div>
<a
class="css-1a492j3"
class="css-104abqd"
href="#"
role="button"
tabindex="0"
>
<p
class="css-hr6n41-Button"
class="css-oc644a-Button"
>
This is test
</p>
@@ -20,11 +20,11 @@ exports[`(components) atoms/button > take anchor button's snap shot 1`] = `
exports[`(components) atoms/button > take default button's snap shot 1`] = `
<div>
<button
class="css-1a492j3"
class="css-104abqd"
tabindex="0"
>
<p
class="css-hr6n41-Button"
class="css-oc644a-Button"
>
This is test
</p>
4 changes: 2 additions & 2 deletions src/components/atoms/button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import tw from "twin.macro";
import { ButtonProperties } from "../../../models";
import { ButtonProperties } from "./type/model";
import { Text } from "../text";

const ButtonBox = tw.button`bg-white hover:bg-button-hover inline-block items-start px-8 py-2 gap-2.5 rounded-[2rem]`;
const ButtonBox = tw.button`bg-white hover:bg-button-hover inline-block items-start px-2 py-0.5 sm:px-8 sm:py-2 gap-2.5 rounded-[2rem]`;

const Button = <T extends AnyComponent>({
children,
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { CSSInterpolation } from "@emotion/serialize";
import type { PropsWithChildren } from "react";

export type ButtonProperties<T extends AnyComponent> = React.PropsWithChildren<
export type ButtonProperties<T extends AnyComponent> = PropsWithChildren<
PropertiesOf<T> & {
boxStyles?: CSSInterpolation;
textStyles?: CSSInterpolation;
2 changes: 1 addition & 1 deletion src/components/atoms/text/__snapshots__/text.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
exports[`(components) atoms/text > take snap shot 1`] = `
<div>
<p
class="css-1x10uum"
class="css-199inpx"
>
This is test
</p>
2 changes: 1 addition & 1 deletion src/components/atoms/text/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tw from "twin.macro";

const Text = tw.p`font-zen text-white text-[calc(12px + 4 * ((100vw - 378px) / 1134))] select-none`;
const Text = tw.p`font-zen text-text text-xs sm:text-base select-none`;

export { Text };
13 changes: 12 additions & 1 deletion src/components/atoms/text/text.stories.tsx
Original file line number Diff line number Diff line change
@@ -8,6 +8,17 @@ const data = {
sentence: "This is test",
};

export default { args: { children: data.sentence }, component: Text } as ComponentMeta<T>;
export default {
args: { children: data.sentence },
argTypes: {
children: {
description: "Context of text",
control: {
type: "text",
},
},
},
component: Text,
} as ComponentMeta<T>;

export const Default: Story = {};
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ exports[`(components) molecules/twitter > take snap shot 1`] = `
class="css-g9iroc"
>
<a
class="twitter-timeline css-vle9m6"
class="twitter-timeline css-zld2jk"
data-height="420"
data-width="240"
href="https://twitter.com/KOSENFESTA?ref_src=twsrc%5Etfw"
@@ -21,7 +21,7 @@ exports[`(components) molecules/twitter > take snap shot 1`] = `
class="css-1uvl77q"
>
<a
class="twitter-timeline css-vle9m6"
class="twitter-timeline css-zld2jk"
data-height="410"
data-width="288"
href="https://twitter.com/KOSENFESTA?ref_src=twsrc%5Etfw"
Original file line number Diff line number Diff line change
@@ -12,20 +12,20 @@ exports[`(components) organisms/about-section > take snap shot 1`] = `
鈴鹿高専について
</h1>
<p
class="css-1x10uum"
class="css-199inpx"
>
鈴鹿高専については本校ホームページをご覧ください。
</p>
<a
class="css-1a492j3"
class="css-104abqd"
href="#"
rel="noopener noreferrer"
role="button"
tabindex="0"
target="_brank"
>
<p
class="css-hr6n41-Button"
class="css-oc644a-Button"
>
鈴鹿高専ホームページ
</p>
Original file line number Diff line number Diff line change
@@ -12,20 +12,20 @@ exports[`(components) organisms/contact-section > take snap shot 1`] = `
お問い合わせ
</h1>
<p
class="css-1x10uum"
class="css-199inpx"
>
第57回鈴鹿高専祭に関するお問い合わせは下のボタンからお願いいたします。(google formsが開きます)
</p>
<a
class="css-1a492j3"
class="css-104abqd"
href="#"
rel="noopener noreferrer"
role="button"
tabindex="0"
target="_blank"
>
<p
class="css-hr6n41-Button"
class="css-oc644a-Button"
>
お問い合わせ
</p>
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ exports[`(components) organisms/festa-section > take snap shot 1`] = `
今年のテーマ「Re:ROAD」について
</h1>
<p
class="css-ptd24m-FestaSection"
class="css-19xv45d-FestaSection"
>
第57回鈴鹿高専祭、テーマは「Re:ROAD」
今回のテーマ「Re:ROAD」には「道(Road)」を創り直す(Re)という意味と、「弾をこめる・再補填する(Reload)」という意味を使い、「今年の準備をする」「来年以降、これから先のための高専祭を行う」という想いが込められています。
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ exports[`(components) organisms/footer > take snap shot 1`] = `
role="contentinfo"
>
<a
class="css-vle9m6"
class="css-zld2jk"
href="#"
rel="noopener noreferrer"
role="link"
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ exports[`(components) organisms/hero-section > take snap shot 1`] = `
class="css-bg20hz-HeroSection"
>
<p
class="css-c6teuq-HeroSection"
class="css-19ggdn4-HeroSection"
>
第57回鈴鹿高専祭
</p>
@@ -21,7 +21,7 @@ exports[`(components) organisms/hero-section > take snap shot 1`] = `
width="1212"
/>
<p
class="css-c6teuq-HeroSection"
class="css-19ggdn4-HeroSection"
>
2022.10.30-31
</p>
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ exports[`(components) organisms/map-section > take snap shot 1`] = `
class="css-rwuboe"
>
<p
class="css-1socv45-MapSection"
class="css-4xxnh5-MapSection"
>
510-0294 三重県鈴鹿市白子町
Original file line number Diff line number Diff line change
@@ -12,14 +12,14 @@ exports[`(components) organisms/sponsor-section > take snap shot 1`] = `
協賛企業
</h1>
<p
class="css-gm051n-SponsorSection"
class="css-5i9vob-SponsorSection"
>
今年の高専祭は3年ぶりの開催。
以下の企業様が鈴鹿高専祭を応援してくれています!
</p>
<ul>
<li
class="css-s718ez-SponsorSection"
class="css-12w83hw-SponsorSection"
>
株式会社xx
</li>
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ exports[`(components) templates/layout > take snap shot 1`] = `
class="css-bg20hz-HeroSection"
>
<p
class="css-c6teuq-HeroSection"
class="css-19ggdn4-HeroSection"
>
第57回鈴鹿高専祭
</p>
@@ -27,7 +27,7 @@ exports[`(components) templates/layout > take snap shot 1`] = `
width="1212"
/>
<p
class="css-c6teuq-HeroSection"
class="css-19ggdn4-HeroSection"
>
2022.10.30-31
</p>
@@ -43,7 +43,7 @@ exports[`(components) templates/layout > take snap shot 1`] = `
role="contentinfo"
>
<a
class="css-vle9m6"
class="css-zld2jk"
href="https://github.com/suzuka-kosen-festa/2022-HP/blob/main/LICENSE"
rel="noopener noreferrer"
role="link"
1 change: 0 additions & 1 deletion src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from "./about-section";
export * from "./button";
export * from "./contact-section";
export * from "./festa-section";
export * from "./footer";

0 comments on commit 8d1f6db

Please sign in to comment.