diff --git a/src/design-system/BUILD.bazel b/src/design-system/BUILD.bazel new file mode 100644 index 0000000..bfd29b8 --- /dev/null +++ b/src/design-system/BUILD.bazel @@ -0,0 +1,8 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_library") + +package(default_visibility = ["//visibility:public"]) + +ts_library( + name = "lib", + srcs = glob(["*.ts"]), +) diff --git a/src/design-system/molecules/demo-discord/DemoDiscord.story.tsx b/src/design-system/molecules/demo-discord/DemoDiscord.story.tsx new file mode 100644 index 0000000..601267d --- /dev/null +++ b/src/design-system/molecules/demo-discord/DemoDiscord.story.tsx @@ -0,0 +1,7 @@ +import { moleculeStories } from 'molecules/molecules.story'; +import * as React from 'react'; +import { DemoDiscord } from './DemoDiscord'; + +const story = moleculeStories('Landing Demos', module); + +story.add('Discord', () => ); diff --git a/src/design-system/molecules/demo-discord/DemoDiscord.styled.ts b/src/design-system/molecules/demo-discord/DemoDiscord.styled.ts new file mode 100644 index 0000000..b0c2c72 --- /dev/null +++ b/src/design-system/molecules/demo-discord/DemoDiscord.styled.ts @@ -0,0 +1,67 @@ +import styled, { keyframes } from 'styled-components'; +import { palette } from 'atoms/colors'; + +export const Base = styled.div` + background-color: ${palette.discord100}; + border: solid 1px rgba(0, 0, 0, 0.15); + border-radius: 3px; + padding: 10px; + user-select: none; +`; + +export const Timestamp = styled.span` + padding: 0 5px; + font-size: 0.7em; + opacity: 0.3; +`; + +export const TextParts = styled.span` + padding: 0 5px; +`; + +export const Username = styled(TextParts)` + &:hover { + text-decoration: underline; + cursor: pointer; + } +`; + +export const InputBox = styled.div` + margin-top: 10px; + background-color: ${palette.discord200}; + padding: 7px 10px; + border-radius: 3px; +`; + +const lineBlink = keyframes` + 0% { + opacity: 1; + } + + 40% { + opacity: 1; + } + + 60% { + opacity: 0; + } + + 100% { + opacity: 0; + } +`; + +export const Line = styled.div` + background-color: ${palette.grey600}; + width: 1px; + height: 1.5em; + display: inline-block; + position: absolute; + right: -5px; + animation: ${lineBlink} 0.5s ease-in-out infinite alternate-reverse; +`; + +export const InputTextAlignment = styled.div` + position: relative; + display: inline-block; +`; diff --git a/src/design-system/molecules/demo-discord/DemoDiscord.tsx b/src/design-system/molecules/demo-discord/DemoDiscord.tsx new file mode 100644 index 0000000..5b207c3 --- /dev/null +++ b/src/design-system/molecules/demo-discord/DemoDiscord.tsx @@ -0,0 +1,53 @@ +import * as React from 'react'; +import { + Base, + Timestamp, + TextParts, + Username, + InputBox, + Line, + InputTextAlignment, +} from './DemoDiscord.styled'; +import { demoData } from 'hack/fixtures/demoData'; +import { Typist } from 'atoms/typist'; + +export const DemoDiscord = () => { + const time = new Date(); + const timeString = time.toTimeString(); + + const [easterEggCount, setEasterEggCount] = React.useState(0); + + return ( + + + {time.getHours() % 12}:{timeString.slice(3, 5)}  + {time.getHours() <= 12 ? 'AM' : 'PM'} + + setEasterEggCount(easterEggCount + 1)}> + okano cat + + + {easterEggCount >= 15 + ? `NYAAAAAAA${'A'.repeat(easterEggCount - 15)}` + : easterEggCount >= 11 + ? `I'm.. I'm gonna...` + : easterEggCount >= 10 + ? `S-senpai... Be careful...` + : easterEggCount >= 5 + ? `H-hey... Stop that..` + : `Hey, I'd like some roles!`} + + + +   + `.iam ${role.name}`)} + /> + + + + + ); +}; diff --git a/src/design-system/molecules/demo-discord/index.ts b/src/design-system/molecules/demo-discord/index.ts new file mode 100644 index 0000000..70e62cb --- /dev/null +++ b/src/design-system/molecules/demo-discord/index.ts @@ -0,0 +1 @@ +export * from './DemoDiscord'; diff --git a/src/design-system/molecules/demo-picker/DemoPicker.story.tsx b/src/design-system/molecules/demo-picker/DemoPicker.story.tsx new file mode 100644 index 0000000..6411423 --- /dev/null +++ b/src/design-system/molecules/demo-picker/DemoPicker.story.tsx @@ -0,0 +1,7 @@ +import * as React from 'react'; +import { moleculeStories } from 'molecules/molecules.story'; +import { DemoPicker } from './DemoPicker'; + +const story = moleculeStories('Landing Demos', module); + +story.add('Picker', () => ); diff --git a/src/design-system/molecules/demo-picker/DemoPicker.tsx b/src/design-system/molecules/demo-picker/DemoPicker.tsx new file mode 100644 index 0000000..5137e86 --- /dev/null +++ b/src/design-system/molecules/demo-picker/DemoPicker.tsx @@ -0,0 +1,46 @@ +import * as React from 'react'; +import { Role } from 'atoms/role'; +import { Role as RPCRole } from '@roleypoly/rpc/shared'; +import styled from 'styled-components'; +import { demoData } from 'hack/fixtures/demoData'; + +const Container = styled.div` + display: flex; + flex-wrap: wrap; + justify-content: center; + align-items: center; + align-content: center; + height: 95px; +`; + +const RoleWrap = styled.div` + padding: 2.5px; + display: inline-block; +`; + +export const DemoPicker = () => { + const [selectedStates, setSelectedStates] = React.useState< + { + [key in RPCRole.AsObject['id']]: boolean; + } + >(demoData.reduce((acc, role) => ({ ...acc, [role.id]: false }), {})); + + return ( + + {demoData.map((role) => ( + + { + setSelectedStates({ + ...selectedStates, + [role.id]: !selectedStates[role.id], + }); + }} + /> + + ))} + + ); +}; diff --git a/src/design-system/molecules/demo-picker/index.ts b/src/design-system/molecules/demo-picker/index.ts new file mode 100644 index 0000000..1b9c7d3 --- /dev/null +++ b/src/design-system/molecules/demo-picker/index.ts @@ -0,0 +1 @@ +export * from './DemoPicker'; diff --git a/src/design-system/molecules/footer/Flags.tsx b/src/design-system/molecules/footer/Flags.tsx new file mode 100644 index 0000000..3acfee4 --- /dev/null +++ b/src/design-system/molecules/footer/Flags.tsx @@ -0,0 +1,94 @@ +import * as React from 'react'; + +type FlagsProps = { + width?: number | string; + height?: number | string; +}; + +export const Flags = (props: FlagsProps) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + +); diff --git a/src/design-system/molecules/footer/Footer.story.tsx b/src/design-system/molecules/footer/Footer.story.tsx new file mode 100644 index 0000000..20c6f0d --- /dev/null +++ b/src/design-system/molecules/footer/Footer.story.tsx @@ -0,0 +1,7 @@ +import * as React from 'react'; +import { moleculeStories } from 'molecules/molecules.story'; +import { Footer } from './Footer'; + +const story = moleculeStories('Footer', module); + +story.add('Basic', () =>