Admin Blue Look and Feel Theme
Admin Blue Look and Feel Theme presents simple and clean theme which can be used in many Starticket backend internal projects. The theme contains already predefined Layouts, Menus, Forms, Form controls, List, Dialog etc. with appropriate colors scheme which fits with Starticket brand colors as well.
Table of Contents
Installation
npm install starticket-admin-theme
After npm installation is finished you have to include those links (or some other font you opt for) in index.html
.
After that, in main index.js
file you have to put this code (<App/>
component should be replaced with appropriate component related to your project).
;;;;; ReactDOM;;
Example usage
Now, when you have all prerequsities set, next you need to create a wrapper component which will house our Layout
(in the future you will use that wrapper component as your layout component).
It should be located in separate folder, for example components
folder. This component won't just be a wrapper to our Layout
component but it will hold all props need to be passed to Layout
component.
Layout.js
;; ; /** * @class src/components/LayoutWrapper */ state = selectedId : '10' section : 'show' selectedMenuItem : 'Show Management' name : 'New Show' topNavigationMenuItems : 'Dashboard' : 'href' : '/' 'icon' : 'path' : './images/home.svg' 'alt' : 'Home' 'dropdown' : null sidebarNavigationMenuItems : 'Show Management' : 'items' : 'Shows' : 'href' : '/shows' 'number' : 10 'Devices' : 'href' : '/devices' 'number' : 50 'Actions' : 'href' : '/actions' 'number' : 5 ; /** * Logs out user. */ { // Logout functionality }; /** * @returns */ return <Layout topNavigationMenuItems=thisstatetopNavigationMenuItems sidebarNavigationMenuItems=thisstatesidebarNavigationMenuItems selectedMenuItem=thisstateselectedMenuItem id=thisstateselectedId section=thisstatesection name=thisstatename logoutFunction=thislogout> thispropschildren </Layout> ; ; ;
After that, next thing you need to do, is to make a route wrapper which will be used to render certain scene with certain layout for certain path.
It should be located in your main application component (in this example it is <App/>
component) and it will be just a simple component like it is shown bellow.
App.js
; /** * Route wrapper. * * @param * @param * @param * * @returns */const RouteWrapper = <Route ...rest render= <Layout> <Component ...props /> </Layout> />;
Next, everything you have to do is to use this RouteWrapper
component, inside your render method, and pass to it path, layout (the layout wrapper you created few steps ago) and scene you want to render.
App.js
;;; ... /** * @returns */ { return <div className="App"> <Switch> <RouteWrapper path='/' exact component=HomeScene layout=LayoutWrapper /> </Switch> </div> ;}
Here you may see the example of HomeScene
component with registration form:
HomeScene.js
; ... /** * @returns */ return <div> <SceneTitle text="Home Scene"/> <Panel title="Registration Form"> <Form> <Input label="First name" name="first-name" getValue=thisgetFirstNameValue /> <Input label="Last name" name="last-name" getValue=thisgetLastNameValue /> <Email label="Email" name="email" getValue=thisgetEmailValue /> </Form> <Button onClickHandler=thissubmitForm>Submit form</ThemeButton> </Panel> </div> ;;
Components API
Layout
Usage example
;; /** * @class src/scenes/Home/Home */ state = selectedId : '10' section : 'show' selectedMenuItem : 'Show Management' name : 'New Show' topNavigationMenuItems : 'Dashboard' : 'href' : '/' 'icon' : 'path' : './images/home.svg' 'alt' : 'Home' 'dropdown' : null sidebarNavigationMenuItems : 'Show Management' : 'items' : 'Shows' : 'href' : '/shows' 'number' : 10 'Devices' : 'href' : '/devices' 'number' : 50 'Actions' : 'href' : '/actions' 'number' : 5 ; /** * Logs out user. */ { // Logout functionality }; /** * Return user one step backward. */ { // Go back functionality }; /** * @returns */ return <Layout topNavigationMenuItems=thisstatetopNavigationMenuItems sidebarNavigationMenuItems=thisstatesidebarNavigationMenuItems selectedMenuItem=thisstateselectedMenuItem id=thisstateselectedId section=thisstatesection name=thisstatename logoutFunction=thislogout goBack=thisgoBack> thispropschildren </Layout> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
topNavigationMenuItems | object |
true |
Items for top (header) navigation. | |
sidebarNavigationMenuItems | object |
true |
Items for sidebar navigation. | |
selectedMenuItem | string |
true |
Selected menu item from previous page, for example Show Management, Device Management... | |
section | string |
true |
Represent admin area (section) for example show, venue, device... | |
name | string |
true |
Name of selected show, venue, event... | |
id | string |
true |
Id of selected show, venue, event... | |
withoutSidebar | false |
Renders layout without sidebar. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
logoutFunction | function |
true |
Handles logout functionallity. |
goBack | function |
true |
Handles returning user one step backward. |
LayoutDashboard
Usage example
;; /** * @class src/scenes/Home/Home */ state = topNavigationMenuItems : 'Dashboard' : 'href' : '/' 'icon' : 'path' : './images/home.svg' 'alt' : 'Home' 'dropdown' : null dashboardMenuItems : 'Action Management' : 'href' : '/dashboard/actions' path : '/dashboard/actions' ; /** * Logs out user. */ { // Logout functionality }; /** * Change tab handler. */ { this; }; /** * @returns */ return <ThemeLayoutDashboard topNavigationMenuItems=thisstatetopNavigationMenuItems logoutFunction=thislogout dashboardMenuItems=thisstatedashboardMenuItems path=thisstatepath changeTabHandler=thischangeTab withoutSidebar> thispropschildren </ThemeLayoutDashboard> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
topNavigationMenuItems | object |
true |
Items for top (header) navigation. | |
dashboardMenuItems | object |
true |
Items for dashboard navigation (tabs). | |
withoutSidebar | true |
Removes blue background color from header hamburger menu. | ||
path | string |
true |
Path for the default selected tab. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
logoutFunction | function |
true |
Handles logout functionallity. |
changeTabHandler | function |
true |
Handles tab changing functionallity. |
Panel
Usage example
;; /** * @class src/scenes/Home/Home */ /** * @returns */ return <Panel title="Home Scene" colorize> /*Panel content*/ </Panel> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
title | string |
true |
Title shows at panel header. | |
className | string |
false |
'' |
By adding one of <edit / remove / up / down >. |
colorize | bool |
false |
This options mark panel header with gray background. | |
layersIcon | bool |
false |
Shows icons at left side of panel header. | |
draggable | bool |
false |
Allow panel to be dragged. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
removeHandler | function |
conditional |
Required if panel has class remove . |
editHandler | function |
conditional |
Required if panel has class edit . |
directionDownHandler | function |
conditional |
Required if panel has class down . |
directionUpHandler | function |
conditional |
Required if panel has class up . |
Form
Button
Usage example
;; /** * @class src/scenes/Home/Home */ /** * Handles button click. */ { }; /** * @returns */ return <Button onClickHandler=thisbuttonClick>Click me!</Button> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
size | ButtonSizeMedium, ButtonSizeSmall, ButtonSizeTiny, ButtonEmptyAttribute, ButtonSizeLarge |
false |
medium |
Button size. |
type | ButtonTypeSocial, ButtonTypeGhost, ButtonEmptyAttribute, ButtonTypeCancel |
false |
'' |
Button type. |
status | ButtonStatusDisabled, ButtonEmptyAttribute |
false |
'' |
Button status. |
className | string |
false |
'' |
Additional button classes. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
onClickHandler | function |
false |
Handles click on button. |
Checkbox
Usage example
;; /** * @class src/scenes/Home/Home */ state = isChecked : false ; /** * Returns checkbox object with name and value. * * @param */ { if thisstateisChecked !== checkboxvalue this; }; /** * @returns */ return <Form> <Checkbox name="terms" label="Terms and conditions" checked=thisstateisChecked getValue=thisgetValue/> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
label | string |
true |
Checkbox label. | |
name | string |
true |
Checkbox name. | |
checked | bool |
true |
Makes checkbox checked or not. | |
disabled | bool |
false |
false |
Disabled checkbox. |
className | string |
false |
'' |
Additional checkbox classes. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns checkbox value. |
Usage example
;; /** * @class src/scenes/Home/Home */ /** * Returns email object with name and value. * * @param */ { }; /** * @returns */ return <Form> <Email label="Email" name="email" getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
label | string |
false |
'' |
Email label. |
name | string |
true |
'' |
Email name. |
className | string |
false |
'' |
Additional email classes. |
value | bool |
false |
Predefined email value. | |
readOnly | bool |
false |
false |
Makes email readonly. |
disabled | bool |
false |
false |
Makes email disabled. |
placeholder | string |
false |
Email |
Email placeholder. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns email object with name and value. |
onKeyUp | function |
false |
Handles onKeyUp event. |
onBlur | function |
false |
Handles onBlur event. |
Password
Usage example
;; /** * @class src/scenes/Home/Home */ /** * Returns password object with name and value. * * @param */ { }; /** * @returns */ return <Form> <Password label="Password" name="password" getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
label | string |
false |
'' |
Password label. |
name | string |
true |
'' |
Password name. |
value | bool |
false |
Predefined password value. | |
readOnly | bool |
false |
false |
Makes password readonly. |
disabled | bool |
false |
false |
Makes password disabled. |
placeholder | string |
false |
'' |
Password placeholder. |
className | string |
false |
'' |
Additional password classes. |
Interaction Options`
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns password object with name and value. |
onKeyUp | function |
false |
Handles onKeyUp event. |
onBlur | function |
false |
Handles onBlur event. |
RadioGroup
Usage example
;; /** * @class src/scenes/Home/Home */ state = defaultValue : 'male' labels : 'male' : 'Male' 'female' : 'Female' /** * Returns event object. * * @param */ { if thisstatedefaultValue !== eventtargetvalue this; }; /** * @returns */ return <Form> <RadioGroup name="sex" defaultValue=thisstatedefaultValue labels=thisstatelabels getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
name | string |
true |
Radio group name. | |
defaultValue | string |
true |
Selected option. | |
className | string |
false |
Additional radio group classes. | |
disabled | bool |
false |
Makes radio group disabled. | |
readOnly | bool |
false |
Makes radio group readonly. | |
disabledValues | string |
false |
Makes certain option disabled. | |
labels | object |
true |
Radio group options. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns event object. |
Search
Usage example
;; /** * @class src/scenes/Home/Home */ /** * Returns search object with name and value. * * @param */ { }; /** * @returns */ return <Form> <Search name="search" getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
label | string |
false |
'' |
Search label. |
name | string |
true |
''text' + Math.floor(Math.random() * 10)' |
Search name. |
value | string |
false |
Search value. | |
disabled | bool |
false |
false |
Makes Search disabled. |
className | string |
false |
'' |
Additional Search classes. |
readOnly | bool |
false |
false |
Makes Search readonly. |
placeholder | string |
false |
'Enter text here' |
Search placeholder. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns seacrh object. |
onKeyUp | function |
false |
Handles onKeyUp event. |
onBlur | function |
false |
Handles onBlur event. |
Select
Usage example
;; /** * @class src/scenes/Home/Home */ state = selectData : 'sr' : 'Serbia' 'gr' : 'Greece' 'it' : 'Italy' /** * Returns select object with uid and value. * * @param */ { }; /** * @returns */ return <Form> <Select name="search" data=thisstateselectData getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
name | string |
true |
''select' + Math.floor(Math.random() * 10)' |
Select name. |
data | object |
true |
Select data. | |
uid | string |
false |
Select uid. | |
initialValue | string |
false |
Initialy selected option. | |
value | string |
false |
Selected option. | |
disabled | bool |
false |
false |
Makes select disabled. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns select object. |
Switch
Usage example
;; /** * @class src/scenes/Home/Home */ state = isChecked : false /** * Returns switch value. * * @param */ { if isChecked !== thisstateisChecked this; }; /** * @returns */ return <Form> <Switch name="isActive" label="Is active?" checked=thisstateisChecked getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
name | string |
true |
Switch name. | |
label | string |
true |
Switch label. | |
checked | bool |
true |
Checks/Unchecks switch. | |
className | string |
false |
'' |
Additional switch classes. |
disabled | bool |
false |
false |
Makes switch disabled. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns switch value. |
Text
Usage example
;; /** * @class src/scenes/Home/Home */ /** * Returns text object with name and value. * * @param */ { }; /** * @returns */ return <Form> <Text label="Company" name="company" getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
label | string |
false |
Text label. | |
name | string |
true |
Text name. | |
className | string |
false |
'' |
Additional text classes. |
value | bool |
false |
Predefined text value. | |
readOnly | bool |
false |
false |
Makes text readonly. |
disabled | bool |
false |
false |
Makes text disabled. |
placeholder | string |
false |
'' |
Text placeholder. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns text object with name and value. |
onKeyUp | function |
false |
Handles onKeyUp event. |
onBlur | function |
false |
Handles onBlur event. |
Textarea
Usage example
;; /** * @class src/scenes/Home/Home */ /** * Returns event. * * @param */ { }; /** * @returns */ return <Form> <Textarea label="Biography" name="bio" getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
label | string |
false |
'' |
Textarea label. |
name | string |
true |
'textarea' + Math.floor(Math.random() * 10) |
Textarea name. |
readOnly | bool |
false |
false |
Makes textarea readonly. |
disabled | bool |
false |
false |
Makes textarea disabled. |
placeholder | string |
false |
'' |
Textarea placeholder. |
className | string |
false |
'' |
Additional textarea classes. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
onChangeHandler | function |
false |
Returns event object. |
ToggleSwitch
Usage example
;; /** * @class src/scenes/Home/Home */ state = labels : '1' : 'superadmin' '2' : 'admin' '3' : 'contributor' /** * Returns toggle switch event. * * @param */ { }; /** * @returns */ return <Form> <ToggleSwitch name="role" labels=thisstatelabels getValue=thisgetValue /> </Form> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
name | string |
true |
SwitchToggle name. | |
disabledValues | string |
false |
Makes certain option of switchToggle disabled. | |
readonly | bool |
false |
Makes switchToggle readonly. | |
defaultValue | string |
false |
ToggleSwitch default value. | |
disabled | bool |
false |
false |
Makes switchToggle disabled. |
className | string |
false |
'' |
Additional switchToggle classes. |
labels | object |
true |
SwitchToggle options. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
getValue | function |
true |
Returns switchToggle value. |
List
Usage example
;; /** * @class src/scenes/Home/Home */ state = listColumns : 'Id' : 'subtitle':null 'Name' : 'subtitle':null 'Date' : 'subtitle':null listData : 1'Show 1''10-10-2020 10:00' 2'Show 2''12-12-2022 12:00' ; /** * @returns */ return <List columns=thisstatelistColumns data=thisstatelistData /> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
columns | object |
true |
Name of list columns with optional title property. | |
data | array |
false |
List cells data. |
Dialog
Usage example
;; /** * @class src/scenes/Home/Home */ state = showDialog: true ; /** * Handles dialog confirmation. */ { }; /** * Closes dialog. */ { this; }; /** * @returns */ return <Dialog title="Theme Dialog" show=thisstateshowDialog action=thisconfirmDialog closeDialog=thiscloseDialog> Starticket Theme Dialog </Dialog> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
title | string |
false |
Title shown at dialog header. | |
additionalTitle | string |
false |
Subtitle shown beside title at dialog header. | |
show | bool |
true |
Shows (pop ups) dialog. | |
mainButton | string |
false |
Create |
Confirmation button name. |
mainButtonDisabled | bool |
false |
Disables confirmation button. | |
cancellationButton | string |
false |
Cancel |
Cancelation button name. |
hideCancellationButton | bool |
false |
false |
Hides cancelation button. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
action | function |
true |
Handles dialog confirmation. |
closeDialog | function |
true |
Handles dialog cancelation. |
DialogError
Usage example
;; /** * @class src/scenes/Home/Home */ state = showDialogError: true ; /** * Closes dialog. */ { this; }; /** * @returns */ return <DialogError show=thisstateshowDialogError closeDialog=thiscloseDialog> Unfortunatelly an error occurred! </DialogError> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
show | bool |
true |
Shows (pop ups) error dialog. |
Interaction Options
Option | Type | Required | Description |
---|---|---|---|
closeDialog | function |
true |
Handles error dialog cancelation. |
Alert
Usage example
;; /** * @class src/scenes/Home/Home */ /** * @returns */ return <Alert type=AlertTypeSuccess> /*Alert content*/ </Alert> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
type | AlertTypeSuccess, AlertTypeError, AlertTypeInfo |
true |
Type of alert. |
Title
Usage example
;; /** * @class src/scenes/Home/Home */ /** * @returns */ return <SceneTitle text="Home Scene"/> ; ; ;
Options
Option | Type | Required | Defaults | Description |
---|---|---|---|---|
text | string |
false |
'' |
Scene title text. |
Licence
Private
Versioning
We use SemVer for versioning. Current version is v1.0.0-beta
Authors
- Ana Simonović - Developer - ana.simonovic@starticket.ch
- Stevan Tošić - Developer - stevan.tosic@starticket.ch
- Nikola Radović - Developer - nikola.radovic@starticket.ch
- Milivoje Vujadinović - Team Lead - milivoje.vujadinovic@starticket.ch
Built With
- React JS - The JavaScript Library Used