From 815f3c6b28aeb9ee90bac38ff39c3cbcd77d4d2b Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 1 Mar 2022 19:53:23 -0800 Subject: [PATCH] Added ElementToggle component A segmented control for selecting an element --- components/ElementToggle/index.scss | 59 +++++++++++++++++++++++++++++ components/ElementToggle/index.tsx | 38 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 components/ElementToggle/index.scss create mode 100644 components/ElementToggle/index.tsx diff --git a/components/ElementToggle/index.scss b/components/ElementToggle/index.scss new file mode 100644 index 00000000..c97a1d19 --- /dev/null +++ b/components/ElementToggle/index.scss @@ -0,0 +1,59 @@ +.ToggleGroup { + $height: 36px; + + border: 1px solid rgba(0, 0, 0, 0.14); + border-radius: $height; + display: flex; + height: $height; + gap: $unit / 4; + padding: $unit / 2; + + .ToggleItem { + background: white; + border: none; + border-radius: 18px; + color: $grey-40; + flex-grow: 1; + font-size: $font-regular; + padding: ($unit) $unit * 2; + + &:hover { + cursor: pointer; + } + + &:hover, &[data-state="on"] { + background:$grey-80; + color: $grey-00; + + &.fire { + background: $fire-bg-light; + color: $fire-text-dark; + } + + &.water { + background: $water-bg-light; + color: $water-text-dark; + } + + &.earth { + background: $earth-bg-light; + color: $earth-text-dark; + } + + &.wind { + background: $wind-bg-light; + color: $wind-text-dark; + } + + &.dark { + background: $dark-bg-light; + color: $dark-text-dark; + } + + &.light { + background: $light-bg-light; + color: $light-text-dark; + } + } + } +} \ No newline at end of file diff --git a/components/ElementToggle/index.tsx b/components/ElementToggle/index.tsx new file mode 100644 index 00000000..6e09920a --- /dev/null +++ b/components/ElementToggle/index.tsx @@ -0,0 +1,38 @@ +import React from 'react' +import * as ToggleGroup from '@radix-ui/react-toggle-group' + +import './index.scss' + +interface Props { + currentElement: number +} + +const ElementToggle = (props: Props) => { + return ( + + + Null + + + Wind + + + Fire + + + Water + + + Earth + + + Dark + + + Light + + + ) +} + +export default ElementToggle \ No newline at end of file