1.4.1 • Published 8 months ago

js-json-as-card v1.4.1

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

js-json-as-card

A React component for presenting JSON data within a styled card.

FieldTypeRequiredDefaultDescription
idstringnoundefinedId of the HTML component.
jsonobjectyesN/AJSON for presentation.
formatbooleannofalseFormat label like name => Name or primary_email => Primary email.
styleCardReact.CSSPropertiesnoCardContainerObject style for the card container.
styleLabelReact.CSSPropertiesnoN/AObject style for the labels.
styleTextReact.CSSPropertiesnoCardTextObject style for the text content.
complementComponentReact.ReactNodenoN/AAdditional React component to be rendered alongside the main content.
excludearray of stringsnoN/AList of JSON fields to ignore when rendering or processing.
const CardContainer = styled.div`
  position: relative;
  background-color: #f0f0f0;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  margin: 16px;
  font-family: Arial, sans-serif;
`;
const CardText = styled.div`
  margin-left: 0.5rem;
`;

Example

    import { CardJson } from 'js-json-as-card';

    const user = {
            name: 'Julio Silva',
            email: 'julio@email.com',
            phone: '+55 11 99999-9999'
        }

    <CardJson json={user}/>

Example

    import { CardJson } from 'js-json-as-card';

    const user = {
            name: 'Julio Silva',
            email: 'julio@email.com',
            phone: '+55 11 99999-9999'
        }

    <CardJson {...args} 
        id="user"
        styleCard={{
            backgroundColor: "#E1F5FE", 
            fontFamily: "Arial, sans-serif",
            borderRadius: 0,
            boxShadow: 'none'
        }} 
        styleLabel={{
            width: '50px',
            border: '1px'
        }}
        styleText={{
            marginLeft: '1rem'
        }}
        format={true}
        complementComponent={
            <div style={{ padding: '10px 0'}}>
            <Button onClick={() => alert('Click') }>
                Open
                </Button>
            </div>
        }
    />

Example

    import { CardJson } from 'js-json-as-card';

    const user = {
            "Name": 'Julio Silva',
            "E-mail": 'julio@email.com',
            "Phone": '+55 11 99999-9999'
        }

    <CardJson json={user}/>

Example

1.2.0

8 months ago

1.3.7

8 months ago

1.3.6

8 months ago

1.3.5

8 months ago

1.3.4

8 months ago

1.3.3

8 months ago

1.4.1

8 months ago

1.3.2

8 months ago

1.4.0

8 months ago

1.3.1

8 months ago

1.3.0

8 months ago

1.3.9

8 months ago

1.3.8

8 months ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago