forked from LaconicNetwork/icns-frontend
Merge branch 'main' of https://github.com/interchain-name/icns-frontend into main
This commit is contained in:
commit
70a58e9bdf
@ -4,7 +4,6 @@ import { Dispatch, FunctionComponent, SetStateAction } from "react";
|
|||||||
import { ChainImage } from "./chain-image";
|
import { ChainImage } from "./chain-image";
|
||||||
import { Flex1 } from "../../styles/flex-1";
|
import { Flex1 } from "../../styles/flex-1";
|
||||||
import {
|
import {
|
||||||
ChainCheckBox,
|
|
||||||
ChainImageContainer,
|
ChainImageContainer,
|
||||||
ChainInfoContainer,
|
ChainInfoContainer,
|
||||||
ChainItemContainer,
|
ChainItemContainer,
|
||||||
@ -13,6 +12,7 @@ import {
|
|||||||
} from "./chain-item";
|
} from "./chain-item";
|
||||||
import color from "../../styles/color";
|
import color from "../../styles/color";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
import { Checkbox } from "../checkbox";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
allChecked: boolean;
|
allChecked: boolean;
|
||||||
@ -49,7 +49,7 @@ export const AllChainsItem: FunctionComponent<Props> = (props) => {
|
|||||||
|
|
||||||
<Flex1 />
|
<Flex1 />
|
||||||
|
|
||||||
<ChainCheckBox checked={allChecked} readOnly />
|
<Checkbox checked={allChecked} />
|
||||||
</ChainItemContainer>
|
</ChainItemContainer>
|
||||||
</AllChainsContainer>
|
</AllChainsContainer>
|
||||||
);
|
);
|
||||||
|
@ -5,6 +5,7 @@ import color from "../../styles/color";
|
|||||||
import { Flex1 } from "../../styles/flex-1";
|
import { Flex1 } from "../../styles/flex-1";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { ChainImage } from "./chain-image";
|
import { ChainImage } from "./chain-image";
|
||||||
|
import { Checkbox } from "../checkbox";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
chainItem: ChainItemType;
|
chainItem: ChainItemType;
|
||||||
@ -52,7 +53,7 @@ export const ChainItem: FunctionComponent<Props> = (props) => {
|
|||||||
|
|
||||||
<Flex1 />
|
<Flex1 />
|
||||||
|
|
||||||
<ChainCheckBox checked={checked} readOnly />
|
<Checkbox checked={checked} />
|
||||||
</ChainItemContainer>
|
</ChainItemContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -125,10 +126,3 @@ export const WalletAddress = styled.div`
|
|||||||
|
|
||||||
color: ${color.grey["400"]};
|
color: ${color.grey["400"]};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const ChainCheckBox = styled.input.attrs({ type: "checkbox" })`
|
|
||||||
width: 1.5rem;
|
|
||||||
height: 1.5rem;
|
|
||||||
|
|
||||||
accent-color: ${color.orange["200"]};
|
|
||||||
`;
|
|
||||||
|
70
components/checkbox/index.tsx
Normal file
70
components/checkbox/index.tsx
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import { FunctionComponent } from "react";
|
||||||
|
import color from "../../styles/color";
|
||||||
|
import styled from "styled-components";
|
||||||
|
|
||||||
|
export const Checkbox: FunctionComponent<{ checked: boolean }> = ({
|
||||||
|
checked,
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<ChainCheckBoxContainer>
|
||||||
|
<ChainCheckBoxHidden checked={checked} readOnly={true} />
|
||||||
|
<ChainCheckBoxStyled checked={checked}>
|
||||||
|
<Center>
|
||||||
|
<Icon width="18" height="14" viewBox="0 0 15 12">
|
||||||
|
<path
|
||||||
|
strokeLinecap="square"
|
||||||
|
strokeWidth="2"
|
||||||
|
d="M2.25 4.426l4.083 5.011 6.417-7.874"
|
||||||
|
/>
|
||||||
|
</Icon>
|
||||||
|
</Center>
|
||||||
|
</ChainCheckBoxStyled>
|
||||||
|
</ChainCheckBoxContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const Center = styled.div`
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Icon = styled.svg`
|
||||||
|
fill: none;
|
||||||
|
stroke: ${color.orange["50"]};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const ChainCheckBoxContainer = styled.div`
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const ChainCheckBoxStyled = styled.div<{ checked: boolean }>`
|
||||||
|
display: inline-block;
|
||||||
|
width: 1.5rem;
|
||||||
|
height: 1.5rem;
|
||||||
|
border: ${(props) => (props.checked ? "none" : "2px solid #868686")};
|
||||||
|
background: ${(props) =>
|
||||||
|
props.checked ? color.orange["200"] : color.grey["400"]};
|
||||||
|
|
||||||
|
${Icon} {
|
||||||
|
visibility: ${(props) => (props.checked ? "visible" : "hidden")};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const ChainCheckBoxHidden = styled.input.attrs({ type: "checkbox" })`
|
||||||
|
border: 0;
|
||||||
|
clip: rect(0 0 0 0);
|
||||||
|
clip-path: inset(50%);
|
||||||
|
height: 1px;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
position: absolute;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 1px;
|
||||||
|
`;
|
@ -38,10 +38,9 @@ const SearchContainer = styled.div`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.625rem;
|
gap: 0.625rem;
|
||||||
|
|
||||||
min-width: 10rem;
|
|
||||||
height: 2.3rem;
|
height: 2.3rem;
|
||||||
|
|
||||||
padding: 0.5rem 1.3rem;
|
padding: 0.6rem 1.4rem;
|
||||||
|
|
||||||
border-radius: 3rem;
|
border-radius: 3rem;
|
||||||
background-color: ${color.grey["700"]};
|
background-color: ${color.grey["700"]};
|
||||||
@ -66,6 +65,9 @@ const SearchText = styled.input`
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 1.2rem;
|
line-height: 1.2rem;
|
||||||
|
|
||||||
|
width: 5.5rem;
|
||||||
|
transition: width 0.2s ease-out;
|
||||||
|
|
||||||
::placeholder,
|
::placeholder,
|
||||||
::-webkit-input-placeholder {
|
::-webkit-input-placeholder {
|
||||||
color: ${color.grey["400"]};
|
color: ${color.grey["400"]};
|
||||||
@ -73,5 +75,7 @@ const SearchText = styled.input`
|
|||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|
||||||
|
width: 10rem;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user