Skip to content
Open
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
8 changes: 6 additions & 2 deletions example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ const App = () => {
}
}}>Dial</button>
</div> : null}
<div>
<h3>React-Sip-Phone</h3>
<ReactSipPhone
name={name || ''}
width={300}
height={600}
sipCredentials={{
sipuri: sipuri || '',
password: password || ''
Expand All @@ -51,10 +55,10 @@ const App = () => {
appConfig={{
mode: mode || '', // 'strict' will activate a simple and limited user experience. set to sessionLimit 1 if using 'strict'
started: false, // (strict-mode only) keeps track of call button visability during strict-mode
appSize: 'large' // assign 'large' for larger font in status-name and session-status (not session remote-id/display name)
appSize: 'small' // assign 'large', 'medium' or 'small' to deine the font size & button size
}}
width={0}
/>
</div>
</React.Fragment>
)
}
Expand Down
24,855 changes: 5,386 additions & 19,469 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
"deploy": "gh-pages -d example/build"
},
"peerDependencies": {
"react": "^16.0.0"
"react": "^16.0",
"react-dom": "^16.0",
"react-scripts": "^3.4.1"
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.12.1",
"@types/events": "^3.0.0",
"@types/jest": "^25.1.4",
"@types/node-sass": "^4.11.1",
Expand All @@ -51,19 +54,16 @@
"microbundle-crl": "github:JaonL/microbundle#master",
"node-sass": "^4.14.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "^3.4.1"
"prettier": "^2.0.4"
},
"files": [
"dist"
],
"dependencies": {
"@types/react-select": "^3.0.13",
"redux": "^4.0.5",
"react-redux": "^7.2.0",
"react-select": "^3.1.0",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
Expand Down
9 changes: 7 additions & 2 deletions src/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
$primary-color: #96bdf7;
$common-button-color: #ccdbfd;
$secondary-color: #356abb;
$almost-black: #333132;
$almost-black: #495057;
$on-settings-button-color: #ADB5BD;
$border-dialerstring-color:#ADB5BD;
$end-call-button-color: #e5383b;
$start-call-button-color: #80ed99;
$action-buttons-color: #ced4da;
27 changes: 20 additions & 7 deletions src/components/Dialstring.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
height: 80px;
width: 80px;
background: none;
// background-color: #15c73b;
}

.dialInput {
@include common-input;
width: 100%;
}

.dialstringContainerStrict {
Expand All @@ -28,13 +28,26 @@

}

.dialstringContainer {
.dialstringInlineDiv {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
border: 2px solid $almost-black;
border-radius: 100px;
padding: 0 0 0 20px;
}

.dialstringInlineInput {
flex:1;
border: 1px solid $border-dialerstring-color;
padding: 5px;
max-width: 300px;
min-width: 100px;
background-color: hsl(0,0%,100%);
border-radius: 10px;
font-size: 0.9em;
}

.dialstringInlineButton {
padding: 2px;
border: none;
background: white;
cursor: pointer;
}
6 changes: 3 additions & 3 deletions src/components/Dialstring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class Dialstring extends React.Component<Props> {
return null
} else {
return (
<div className={styles.dialstringContainer}>
<div className={styles.dialstringInlineDiv}>
<input
className={styles.dialInput}
className={styles.dialstringInlineInput}
onKeyPress={(e) => {
if (e.key === 'Enter') {
this.handleDial()
Expand All @@ -80,7 +80,7 @@ class Dialstring extends React.Component<Props> {
}
/>
<button
className={styles.dialButton}
className={styles.dialstringInlineButton}
disabled={this.checkDialstring()}
onClick={() => this.handleDial()}
>
Expand Down
17 changes: 2 additions & 15 deletions src/components/Status.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,21 @@
align-items: center;
}

.userString {
padding: 2px;
}

.userStringLarge{
padding: 2px;
font-size: 25px;
}

#settingsButton {
@include common-button;
background: none;
height: 24px;
width: 24px;
padding: 2px;
&.on {
background-color: gray;
background-color: $on-settings-button-color;
}
}

#settingsMenu {
flex-direction: column;
transition: all 0.2s ease;
height: 120px;
// height: 120px;
width: 100%;
justify-content: flex-start;
&.closed {
Expand All @@ -43,10 +34,6 @@
}
}

#dropdowns {
width: 100%;
}

.dropdownRow {
display: flex;
flex-direction: row;
Expand Down
78 changes: 71 additions & 7 deletions src/components/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import styles from './Status.scss'
import Select from 'react-select'
// eslint-disable-next-line no-unused-vars
import { PhoneConfig, AppConfig } from '../models'
import UserString from './UserString'

const settingsIcon = require('./assets/settings-24px.svg')
const micIcon = require('./assets/mic-24px.svg')
Expand All @@ -31,6 +32,72 @@ interface Props {
sinkIdAllowed: boolean
}

export const getcustomStyles = (appSize: string) => {
// Default Large
let HeightSelect = '40px'
let FontSizeSelect = '1em'
if (appSize === 'large') {
HeightSelect = '30px'
FontSizeSelect = '1em'
} else if (appSize === 'medium') {
HeightSelect = '25px'
FontSizeSelect = '0.9em'
} else if (appSize === 'small') {
HeightSelect = '20px'
FontSizeSelect = '0.8em'
}

const customStyles = {
container: (provided: any) => ({
...provided,
display: 'inline-block',
minHeight: '1px',
textAlign: 'left',
width: '100%',
border: 'none',
height: HeightSelect,
fontSize: FontSizeSelect,
color: '#9d9d9d'
}),
control: (provided: any) => ({
...provided,
minHeight: '10px',
fontSize: '0.8em'
}),
indicatorsContainer: (provided: any) => ({
...provided,
height: HeightSelect,
minHeight: HeightSelect
}),
clearIndicator: (provided: any) => ({
...provided,
padding: '5px'
}),
dropdownIndicator: (provided: any) => ({
...provided,
padding: '5px'
}),
input: (provided: any) => ({
...provided,
minHeight: '1px'
}),
valueContainer: (provided: any) => ({
...provided,
// minHeight: '1px',
minHeight: HeightSelect,
height: '18px',
paddingTop: '0',
paddingBottom: '0'
}),
singleValue: (provided: any) => ({
...provided,
minHeight: '1px',
paddingBottom: '2px'
})
}
return customStyles
}

class Status extends React.Component<Props> {
state = { settingsMenu: false }

Expand Down Expand Up @@ -66,11 +133,8 @@ class Status extends React.Component<Props> {
return (
<React.Fragment>
<div className={styles.container}>
{props.appConfig.appSize === 'large' ? (
<div className={styles.userStringLarge}>{props.name}</div>
) : (
<div className={styles.userString}>{props.name}</div>
)}
<UserString appSize={props.appConfig.appSize} name={props.name} />

{props.phoneConfig.disabledFeatures.includes('settings') ? null :(
<div
id={styles.settingsButton}
Expand All @@ -92,6 +156,7 @@ class Status extends React.Component<Props> {
<div className={styles.dropdownRow}>
<img className={styles.dropdownIcon} src={soundIcon} />
<Select
styles={getcustomStyles(props.appConfig.appSize)}
placeholder='Select Output...'
value={
outputs.find(
Expand All @@ -102,12 +167,12 @@ class Status extends React.Component<Props> {
this.handleChangeDevice('out', option.value)
}
options={outputs}
id={styles.dropdowns}
/>
</div>
<div className={styles.dropdownRow}>
<img className={styles.dropdownIcon} src={micIcon} />
<Select
styles={getcustomStyles(props.appConfig.appSize)}
placeholder='Select Input...'
value={inputs.find(
(input: any) => input.value === props.primaryInput
Expand All @@ -116,7 +181,6 @@ class Status extends React.Component<Props> {
this.handleChangeDevice('in', option.value)
}
options={inputs}
id={styles.dropdowns}
/>
</div>
<hr style={{ width: '100%' }} />
Expand Down
18 changes: 18 additions & 0 deletions src/components/UserString.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@import '../variables';
@import './Status.scss';


.userStringSmall {
padding: 2px;
font-size: 15px;
}

.userStringMedium {
padding: 2px;
font-size: 20px;
}

.userStringLarge{
padding: 2px;
font-size: 25px;
}
23 changes: 23 additions & 0 deletions src/components/UserString.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from 'react'
import styles from './UserString.scss'

interface UserStringProps {
appSize: string
name: string
}

// TODO: rename UserString to AppName ?
const UserString = ({ appSize, name }: UserStringProps) => {
// Default Large
let usedStyle = styles.userStringLarge
if (appSize === 'large') {
usedStyle = styles.userStringLarge
} else if (appSize === 'medium') {
usedStyle = styles.userStringMedium
} else if (appSize === 'small') {
usedStyle = styles.userStringSmall
}
return <div className={usedStyle}>{name}</div>
}

export default UserString
Loading