Skip to content

Commit

Permalink
Merge pull request #14 from calimero-network/chore--format-and-style
Browse files Browse the repository at this point in the history
refactor: format and style
  • Loading branch information
alenmestrov authored Nov 27, 2024
2 parents 1732a50 + 305270f commit b30bafd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 16 deletions.
15 changes: 11 additions & 4 deletions src/components/common/input/Styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export const Label = styled.label`
color: #ffffff;
`;

export const StyledInput = styled.input<{ $hasError?: boolean; $noMargin?: boolean; $showingCharCount?: boolean }>`
export const StyledInput = styled.input<{
$hasError?: boolean;
$noMargin?: boolean;
$showingCharCount?: boolean;
}>`
width: 100%;
height: 40px;
padding: 0 12px;
Expand All @@ -26,7 +30,7 @@ export const StyledInput = styled.input<{ $hasError?: boolean; $noMargin?: boole
border-color 0.15s ease-in-out,
box-shadow 0.15s ease-in-out;
box-sizing: border-box;
margin-bottom: ${props => {
margin-bottom: ${(props) => {
if (props.$noMargin) return '0';
if (props.$showingCharCount) return '0';
return '0.5rem';
Expand Down Expand Up @@ -68,10 +72,13 @@ export const ErrorMessage = styled.span`
margin-top: 0.25rem;
`;

export const InputContainer = styled.div<{ noMargin?: boolean; showingCharCount?: boolean }>`
export const InputContainer = styled.div<{
noMargin?: boolean;
showingCharCount?: boolean;
}>`
display: flex;
flex-direction: column;
margin-bottom: ${props => {
margin-bottom: ${(props) => {
if (props.noMargin) return '0';
if (props.showingCharCount) return '0';
return '1rem';
Expand Down
13 changes: 11 additions & 2 deletions src/components/common/input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@ interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
showingCharCount?: boolean;
}

const Input: React.FC<InputProps> = ({ label, noMargin, showingCharCount, ...props }) => {
const Input: React.FC<InputProps> = ({
label,
noMargin,
showingCharCount,
...props
}) => {
return (
<InputContainer noMargin={noMargin} showingCharCount={showingCharCount}>
<Label>{label}</Label>
<StyledInput $noMargin={noMargin} $showingCharCount={showingCharCount} {...props} />
<StyledInput
$noMargin={noMargin}
$showingCharCount={showingCharCount}
{...props}
/>
</InputContainer>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/popup/Styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const ErrorMessage = styled.p`

export const CharacterCount = styled.small<{ warning: boolean }>`
display: block;
color: ${props => props.warning ? 'orange' : 'inherit'};
color: ${(props) => (props.warning ? 'orange' : 'inherit')};
font-style: italic;
margin-bottom: 1rem;
`;
6 changes: 4 additions & 2 deletions src/components/node/nodeInitPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ interface NodeInitializationPopupProps {
handleNodeSelect: (nodeName: string) => void;
}

const NodeInitializationPopup: React.FC<NodeInitializationPopupProps> = ({...props}) => {
const NodeInitializationPopup: React.FC<NodeInitializationPopupProps> = ({
...props
}) => {
const [nodeName, setNodeName] = useState('');
const [serverPort, setServerPort] = useState('');
const [swarmPort, setSwarmPort] = useState('');
Expand Down Expand Up @@ -49,7 +51,7 @@ const NodeInitializationPopup: React.FC<NodeInitializationPopupProps> = ({...pro
setTimeout(() => {
props.handleNodeSelect(nodeName);
props.onClose();
}, 1500);
}, 1500);
} else {
setMessage('Error: ' + response.message);
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/node/nodeOperations/Styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export const Tab = styled.div<{ active: boolean }>`
cursor: pointer;
// border: 1px solid #ccc;
border-bottom: none;
background-color: ${props => props.active ? '#000000' : '#2c2c2c'};
font-weight: ${props => props.active ? 'bold' : 'normal'};
background-color: ${(props) => (props.active ? '#000000' : '#2c2c2c')};
font-weight: ${(props) => (props.active ? 'bold' : 'normal')};
border-radius: 5px 5px 0 0;
margin-right: 5px;
&:hover {
background-color: #000000;
}
`;
`;
5 changes: 1 addition & 4 deletions src/components/node/nodeOperations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ const NodeOperations: React.FC<NodeOperationsProps> = ({ ...props }) => {
>
Node Logs
</Tab>
<Tab
active={false}
onClick={openAdminDashboard}
>
<Tab active={false} onClick={openAdminDashboard}>
Admin Dashboard
</Tab>
<Tab
Expand Down

0 comments on commit b30bafd

Please sign in to comment.