Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Bugfix/remove linter erros #339

Merged
merged 7 commits into from
Sep 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/Badge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
| **showZero** | | boolean | true | Set whether to show '0' count number in badge or not |
| **opacityVisible** | | boolean | true | Set application of change in color opacity |
| **variant** | | string |'standard' | Set shape of the badge. Available choices are 'dot' and 'standard' |
| **position** | | string | 'right' | Set position of the badge. Available choices are 'left', 'right' , 'top', 'down'. |
| **badgePlacement** | | string | 'right' | Set position of the badge. Available choices are 'left', 'right' , 'top', 'down'. |
| **border** | | string | | Set border color of the badge. |
| **textColor** | | string | '#FFFFFF' | Set textColor of the count number inside the badge. |

Expand Down
26 changes: 16 additions & 10 deletions main/Badge/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { FC } from 'react';
import styled, { css } from 'styled-components/native';
import { FlattenSimpleInterpolation } from 'styled-components';

import { StyleSheet } from 'react-native';
import styled from 'styled-components/native';

interface StyleProps {
color?: string;
Expand All @@ -11,7 +12,7 @@ interface StyleProps {
textColor?: string;
}

export interface BadgeProps extends StyleProps{
export interface BadgeProps extends StyleProps {
count?: number;
maximumCount?: number;
showZero?: boolean;
Expand All @@ -22,38 +23,43 @@ export interface BadgeProps extends StyleProps{
const StyledView = styled.View<StyleProps>`
position: absolute;
top: -15px;
${(props) => props.badgePlacement}: -10px;
width: auto;
min-width: 45px;
height: 45px;
border-color: ${(props) =>
props.border ? props.border : '#00ff0000'};
border-width: 3px;
background-color: ${(props) => props.color};
border-radius: 50px;
justify-content: center;
align-items: center;
opacity: ${(props) => props.opacity};
${(props): FlattenSimpleInterpolation => css`
${props.badgePlacement}: -10px;
opacity: ${props.opacity};
border-color: ${props.border || '#00ff0000'};
background-color: ${props.color};
`}
`;

const StyledText = styled.Text<StyleProps>`
color: ${(props) => props.textColor};
text-align: center;
padding: 5px;
margin-left: 3px;
margin-right: 3px;
${(props): FlattenSimpleInterpolation => css`
color: ${props.textColor};
`}
`;

const StyledDotView = styled.View<StyleProps>`
position: absolute;
top: -5px;
${(props) => props.badgePlacement}: -5px;
width: 20px;
height: 20px;
background-color: ${(props) => props.color};
border-radius: 50px;
justify-content: center;
align-items: center;
${(props): FlattenSimpleInterpolation => css`
${props.badgePlacement}: -5px;
background-color: ${props.color};
`}
`;

const styles = StyleSheet.create({
Expand Down