-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
249 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./horizontal"; | ||
export * from "./styles"; | ||
export * from "./types"; | ||
export * from "./layered"; |
51 changes: 51 additions & 0 deletions
51
packages/extension/src/components/radio-group/layered/comp.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { FunctionComponent } from "react"; | ||
import { Skeleton } from "../../skeleton"; | ||
import { RadioGroupProps } from "../types"; | ||
import { LayeredStyles } from "./styles"; | ||
|
||
export const LayeredHorizontalRadioGroup: FunctionComponent< | ||
RadioGroupProps & { | ||
isNotReady?: boolean; | ||
} | ||
> = ({ | ||
style, | ||
className, | ||
size = "default", | ||
items, | ||
selectedKey, | ||
itemMinWidth, | ||
isNotReady = false, | ||
onSelect, | ||
}) => { | ||
return ( | ||
<Skeleton type="circle" isNotReady={isNotReady}> | ||
<LayeredStyles.Container | ||
style={style} | ||
className={className} | ||
size={size} | ||
isNotReady={isNotReady} | ||
> | ||
{items.map((item) => { | ||
const selected = item.key === selectedKey; | ||
|
||
return ( | ||
<LayeredStyles.Button | ||
key={item.key} | ||
isNotReady={isNotReady} | ||
type="button" | ||
size={size} | ||
selected={selected} | ||
itemMinWidth={itemMinWidth} | ||
onClick={(e) => { | ||
e.preventDefault(); | ||
onSelect(item.key); | ||
}} | ||
> | ||
{item.text} | ||
</LayeredStyles.Button> | ||
); | ||
})} | ||
</LayeredStyles.Container> | ||
</Skeleton> | ||
); | ||
}; |
2 changes: 2 additions & 0 deletions
2
packages/extension/src/components/radio-group/layered/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./comp"; | ||
export * from "./styles"; |
140 changes: 140 additions & 0 deletions
140
packages/extension/src/components/radio-group/layered/styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import styled, { css } from "styled-components"; | ||
import { ColorPalette } from "../../../styles"; | ||
|
||
export const LayeredStyles = { | ||
Container: styled.div<{ | ||
size: "default" | "large"; | ||
isNotReady: boolean; | ||
}>` | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: ${(props) => | ||
props.theme.mode === "light" | ||
? ColorPalette.white | ||
: ColorPalette["gray-600"]}; | ||
box-shadow: ${(props) => | ||
props.theme.mode === "light" && !props.isNotReady | ||
? "0px 1px 4px 0px rgba(43, 39, 55, 0.10)" | ||
: "none"}; | ||
${({ size }) => { | ||
switch (size) { | ||
case "large": { | ||
return css` | ||
height: 2.375rem; | ||
border-radius: 1.1875rem; | ||
padding: 0 0.15625rem; | ||
`; | ||
} | ||
default: { | ||
return css` | ||
height: 1.875rem; | ||
border-radius: 0.9375rem; | ||
padding: 0 0.125rem; | ||
`; | ||
} | ||
} | ||
}}; | ||
`, | ||
Button: styled.button<{ | ||
size: "default" | "large"; | ||
selected: boolean; | ||
itemMinWidth?: string; | ||
isNotReady: boolean; | ||
}>` | ||
position: relative; | ||
${({ selected, isNotReady }) => { | ||
if (selected && isNotReady) { | ||
return css` | ||
::after { | ||
content: ""; | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
border-radius: 999999px; | ||
background-color: ${(props) => { | ||
return props.theme.mode === "light" | ||
? ColorPalette["skeleton-layer-1"] | ||
: ColorPalette["gray-500"]; | ||
}}; | ||
z-index: 999999; | ||
} | ||
`; | ||
} | ||
}} | ||
flex: ${({ itemMinWidth }) => (itemMinWidth ? undefined : 1)}; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
min-width: ${({ itemMinWidth }) => itemMinWidth}; | ||
${({ selected }) => { | ||
if (selected) { | ||
return css` | ||
cursor: auto; | ||
background-color: ${(props) => | ||
props.theme.mode === "light" | ||
? ColorPalette["blue-50"] | ||
: ColorPalette["gray-400"]}; | ||
color: ${(props) => | ||
props.theme.mode === "light" | ||
? ColorPalette["blue-400"] | ||
: ColorPalette.white}; | ||
font-weight: 500; | ||
`; | ||
} | ||
return css` | ||
cursor: pointer; | ||
background-color: ${(props) => | ||
props.theme.mode === "light" | ||
? ColorPalette.white | ||
: ColorPalette["gray-600"]}; | ||
color: ${ColorPalette["gray-300"]}; | ||
font-weight: 400; | ||
`; | ||
}} | ||
${({ size }) => { | ||
switch (size) { | ||
case "large": { | ||
return css` | ||
height: 2.0625rem; | ||
border-radius: 1.03125rem; | ||
font-size: 0.75rem; | ||
padding: 0 0.625rem; | ||
`; | ||
} | ||
default: { | ||
return css` | ||
height: 1.625rem; | ||
border-radius: 0.8125rem; | ||
font-size: 0.75rem; | ||
padding: 0 0.625rem; | ||
`; | ||
} | ||
} | ||
}} | ||
white-space: nowrap; | ||
// Remove normalized css properties. | ||
border-width: 0; | ||
border-style: none; | ||
border-image: none; | ||
`, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 0 additions & 121 deletions
121
packages/extension/src/pages/main/components/string-toggle/index.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.