@webpros/tsxuserprofile

2.1.50 • Public • Published

360 User Profile

A web component that displays a user's information.

Install

npm i @webpros/tsxuserprofile

** Alternative with a CDN** Or download as script from this URL

<script type="module" crossorigin src="https://unpkg.com/@webpros/tsxuserprofile/dist/index.js"></script>

Usage

The user profile <tsx-user-profile> is simply installed in the space provided, the component itself only outputs the content, if a different background colour, round corners, shadows etc. are required, this should be added via a wrapper in which the component is installed.

The component itself also only controls the display of the data, it has no direct connection to an API, all events are therefore sent out via MITT events.

The component is controlled via three props: current-language, user-data, inactive-fields. The data is transmitted as a string (or JSON string) according to the WebComponent specification.

Example

<body>
<tsx-user-profile
  current-language="de"
  user-data="JSON.stringify(myUserData)"
  inactive-fields="[]"
/>
</body>

Props

  • current-language <string> The current language used
  • user-data <JSON object> The data of the user
  • inactive-fields <JSON array> Specifying the profile blocks that you want to deactivate

Usage with Frontend Frameworks

Vue / Nuxt

So that Vue does not treat these elements as regular Vue components the tags must be ignored. The easiest way is to include the elements using plugin.

import Vue from 'vue'
import '@webpros/tsxuserprofile'

Vue.config.ignoredElements = [
  'tsx-user-profile'
]

React / Next

Currently no findings.

Languages

To change the language of the user profile, pass the language code through the prop to the application. Eight languages are available

type TLanguage = 'de' | 'en' | 'fr' | 'es' | 'it' | 'ja' | 'ru' | 'pt'

UserData

Via the user data, we transmit meta information of the user, such as the time zone, name, avatar and email. All information is optional.

If no timezone is transmitted, the profile will use the timezone from the user's browser as soon as it is called up and automatically transmit it to the API.

interface IProfileUser {
  name?: string
  email?: string
  avatar?: string
  timezone?: null | string
}

InactiveFields

This prop can be used to specifically deactivate blocks of the profile, either because they should not be displayed in general, or because perhaps only the time zone should be visible at that point.

Currently the avatar, email and the timezone can be deactivated.

interface IInactiveFields {
  values: Array<'avatar' | 'email' | 'timezone'>
}

Events

All click events are passed on to the outside as MITT events.

Example

window.mitt.on('tsxUserProfile', (payload) => {
  if (payload.timezone) {
    console.log('Hello from changed Timezone', payload.timezone)
  }
})

Colors

The colors are defined using CSSVars and must be included either inline or in the custom stylesheet.

:root {
  --tsxup-brightest: #ffffff;
  --tsxup-brightest-darker: #e5e7eb;
  --tsxup-darkest: #111827;
  --tsxup-darkest-light: #4b5563;
  --tsxup-signal-success: #4CA154;
  --tsxup-signal-error: #b73737;
  --tsxup-primary: #1E40AF;
  --tsxup-primary-light: #668bca;
  /* -- Specific Element CSS Vars */
  --tsxup-text: var(--tsxup-darkest);
  --tsxup-text-lighter: var(--tsxup-darkest-light);
  --tsxup-headline: var(--tsxup-darkest);
  --tsxUp-button-color: var(--tsxup-brightest);
  --tsxUp-button-bg: var(--tsxup-primary);
  --tsxUp-button-color-hover: var(--tsxup-brightest);
  --tsxUp-button-bg-hover: var(--tsxup-primary-light);
  --tsxUp-selectField-border: var(--tsxup-brightest-darker);
  --tsxUp-selectField-background: var(--tsxup-brightest);
  --tsxUp-selectField-backgroundHover: var(--tsxup-brightest);
  --tsxUp-selectField-backgroundDisabled: var(--tsxup-brightest-darker);
  --tsxUp-selectField-color: var(--tsxup-darkest);
  --tsxUp-selectField-selectedBackground: var(--tsxup-primary-light);
  --tsxUp-selectField-selectedColor: var(--tsxup-brightest);
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.1.500latest
1.0.14-beta0beta

Version History

VersionDownloads (Last 7 Days)Published
2.1.500
2.1.460
2.1.450
2.1.440
2.1.430
2.1.420
2.1.410
2.1.400
2.1.390
2.1.380
2.1.370
2.1.360
2.1.36-beta0
2.1.356
2.1.341
2.1.330
2.1.320
2.1.310
2.1.300
2.1.290
2.1.280
2.1.270
2.1.260
2.1.250
2.1.240
2.1.220
2.1.210
2.1.200
2.1.190
2.1.180
2.1.170
2.1.160
2.1.150
2.1.120
2.1.110
2.1.101
2.1.80
2.1.70
2.1.60
2.1.50
2.1.40
2.1.30
2.1.20
2.1.10
2.1.00
2.0.85-beta0
2.0.84-beta0
2.0.83-beta0
2.0.82-beta0
2.0.81-beta0
2.0.80-beta0
2.0.79-beta0
2.0.78-beta0
2.0.77-beta0
2.0.76-beta0
2.0.75-beta0
2.0.74-beta0
2.0.73-beta0
2.0.72-beta0
2.0.71-beta0
2.0.70-beta0
2.0.69-beta0
2.0.68-beta0
2.0.67-beta0
2.0.66-beta0
2.0.65-beta0
1.0.64-beta0
1.0.63-beta0
1.0.62-beta0
1.0.61-beta0
1.0.60-beta0
1.0.59-beta0
1.0.58-beta0
1.0.57-beta0
1.0.56-beta0
1.0.55-beta0
1.0.5-beta0
1.0.54-beta0
1.0.53-beta0
1.0.52-beta0
1.0.51-beta0
1.0.50-beta0
1.0.49-beta0
1.0.48-beta0
1.0.47-beta0
1.0.46-beta0
1.0.45-beta0
1.0.44-beta0
1.0.43-beta0
1.0.42-beta0
1.0.41-beta0
1.0.40-beta0
1.0.39-beta1
1.0.38-beta0
1.0.37-beta0
1.0.36-beta0
1.0.35-beta0
1.0.34-beta0
1.0.33-beta0
1.0.32-beta0
1.0.31-beta0
1.0.30-beta0
1.0.29-beta0
1.0.28-beta0
1.0.27-beta0
1.0.25-beta0
1.0.24-beta0
1.0.23-beta0
1.0.22-beta0
1.0.21-beta0
1.0.20-beta0
1.0.19-beta0
1.0.18-beta0
1.0.17-beta0
1.0.15-beta0
1.0.14-beta0
1.0.110
1.0.100
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.01

Package Sidebar

Install

npm i @webpros/tsxuserprofile

Weekly Downloads

10

Version

2.1.50

License

MIT

Unpacked Size

505 kB

Total Files

18

Last publish

Collaborators

  • landschy
  • saschafuchs