0.3.97 • Published 4 years ago

osu-application v0.3.97

Weekly downloads
222
License
-
Repository
-
Last release
4 years ago

OSU-Application

This is a stylized component library used for building React applications for OSU ECampus. This library is included by default in the 'react-redux-boilerplate' project.

Installation

Installation is crazy easy! Just run the following in your project:

yarn add osu-application

Usage

Let's make your app pretty! Below is the JSX to use inside your React App, just import whatever component you'd like to use.

import {Header, Footer, Welcome, Instructions, GA, FormButton, FormDropdown, FormTextArea, FormInput, Toolbar} from 'osu-application';

Components

Header

This is main header UI for Ecampus interactives.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')Determines which theme to show
courseCodetruenonestringThis is the course code (ex: BA 101)
courseTitletruenonestringThis is the title of the interactive (ex: Matching Game)
disableHelpfalsebooleanpassing true will hide the technical issues link in the header
appStatenoneredux state propsPass Redux state to this prop to gather information on the app when people have technical issues
tokennoneauth tokenPass the token from osu-auth for use in troubleshooting technical issues

Example:

<Header courseCode={'BA 101'} courseTitle={'Matching Game'} />

Footer

This is main footer UI for Ecampus interactives.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')Determines which theme to show

Example:

<Footer />

Welcome

This is main welcome screen used when students first access an Ecampus interactive. It displays the learning objective and an overview of the interactive.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')Determines which theme to show
courseCodetruenonestringThis is the course code (ex: BA 101)
courseTitletruenonestringThis is the title of the interactive (ex: Matching Game)
introtruenonestringThis is an instroduction to the activity
learningObjectivetruenonestringThis is the learning objective for the activity

Example:

<Welcome courseCode={'BA 101'} courseTitle={'Matching Game'} intro={'This is an activity where you match photos'} learningObjective={'For students to learn more about different objects'} />

Toolbar

This is a navigation bar component that can include basic navigation items and call-to-action buttons.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')Determines which theme to show

Children Elements

Children elements must be wrapped in special tags to signify what they are.

NavItem

tags are navigation links shown on the left-hand side of the bar.

Props
Prop NameRequiredDefaultExpectingDescription
keystruenonenumberKey of the object
customStylesnoneobject {{}}Custom styles for the link
actiontruenonefunctionAction taken when pressed
activenonebooleanDenotes active item, must be controlled through your application's state
childrentruenonetagsText children of this tag will be displayed as link text
ActionItem

tags are call to action buttons shown on the right-hand side of the bar.

Props
Prop NameRequiredDefaultExpectingDescription
keystruenonenumberKey of the object
customStylesnoneobject {{}}Custom styles for the link
actiontruenonefunctionAction taken when pressed
childrentruenonestringText children of this tag will be displayed as the button text

Example:

<Toolbar>
    <navItem keys={1} action={() => this.function()} active={true}>
        Home
    </navItem>
    <actionItem keys={1} action={() => this.function()}>
        New Item
    </actionItem>
</Toolbar>

Instructions

These are inline instructions used in interactives.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')Determines which theme to show
widthcalc(100% - 2px)string ('full' or 'padded'), number (will turn into XXpx)Determines the width of the instructions component
childrentruenonestringThese are the instructions shown inside the instructions box

Example:

<Instructions>
    Here are the instructions.
</Instructions>

FormInput

This a stylized form input.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')Determines which theme to show for the input
initialValuetruenonestringThis is the initial value sent to the component. Something must be passed, even if it's an empty string
disabledfalsebooleanDetermines whether the input is disabled or not
customStylesnoneobject {{}}This allows you to pass custom styles to the parent of the input
innerStylesnoneobject {{}}This allows you to pass custom styles to the input
placeholder!Do not use!nonestringDo not use this
inputValuetruenonefunctionThis will fire when there is an onChange event triggered on the input (adding/removing text). Will return the text from the input (no need to define e.target.value)
inputNametruenonestringThis is the name of the input
labeltruenonestringThis is the animated label that tells users what the input is for
onBlurnonefunctionThis is triggered when the input is blurred
onFocusnonefunctionThis is triggered when the input is focused
onClicknonefunctionThis is triggered when the input is clicked
patternnoneRegExPass a regex statement to test the input on
isValidnonefunctionThis is triggered if the pattern specified fails testing

Example:

validate = (name, validity) => {
    this.setState({
        valid: {
            ...this.state.valid,
            [name]: validity
        }
    });
}
...
<FormInput
    initialValue={''}
    inputValue={(e) => this.function(e)}
    inputName={'customInput'}
    label={'Custom Input'}
    isValid={(value) => this.validate('customInput', value)}
    pattern='(someregexpattern)'/>

Use the contents of this.state.valid to determine if the whole form is valid.


FormDropdown

This a stylized form dropdown.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')Determines which theme to show for the input
uniquenonestringFor cases where you need to reset the dropdown to default state, you can pass a new string to this prop and the dropdown will reset
initialValuetruenonestringThis is the initial value sent to the component. Something must be passed, even if it's an empty string
customStylesnoneobject {{}}This allows you to pass custom styles to the parent of the input
innerStylesnoneobject {{}}This allows you to pass custom styles to the input
placeholder!Do not use!nonestringDo not use this
inputValuetruenonefunctionThis will fire when there is an onChange event triggered on the input (adding/removing text). Will return the text from the input (no need to define e.target.value)
inputNametruenonestringThis is the name of the input
labeltruenonestringThis is the animated label that tells users what the input is for
childrentruenonetagsThese are the options that will display in the dropdown

Example:

<FormDropdown initialValue={''} inputValue={(e) => this.function(e)} inputName={'customDropdown'} label={'Custom Dropdown'}>
    <option value=""></option>
    <option value="a">a</option>
    <option value="b">b</option>
</FormDropdown>

FormTextArea

This a stylized form text area.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')Determines which theme to show for the input
initialValuetruenonestringThis is the initial value sent to the component. Something must be passed, even if it's an empty string
customStylesnoneobject {{}}This allows you to pass custom styles to the parent of the input
innerStylesnoneobject {{}}This allows you to pass custom styles to the input
placeholder!Do not use!nonestringDo not use this
inputValuetruenonefunctionThis will fire when there is an onChange event triggered on the input (adding/removing text). Will return the text from the input (no need to define e.target.value)
inputNametruenonestringThis is the name of the input
labeltruenonestringThis is the animated label that tells users what the input is for

Example:

<FormTextArea initialValue={''} inputValue={(e) => this.function(e)} inputName={'customTextArea'} label={'Custom TextArea'} />

FormButton

This a stylized form button.

Props

Prop NameRequiredDefaultExpectingDescription
customStylesnoneobject {{}}This allows you to pass custom styles to the parent of the button
innerStylesnoneobject {{}}This allows you to pass custom styles to the button
actiontruenonefunctionThis function is triggered when the button is pressed
labeltruenonestringThis is the text inside the button

Example:

<FormButton action={(e) => this.function(e)} label={'Button Text'} />

GA

This component will include OSU Ecampus' Google Analytics in your project. No props necessary.

Example:

<GA />

Sidebar

This a customizable sidebar.

Props

Prop NameRequiredDefaultExpectingDescription
theme'light'string ('light' or 'dark')This will change the sidebar to a dark or light theme
sidebarPosition'left'string ('left' or 'right')This determines which side of the screen the sidebar will open from
overlayfalsebooleanThis will include an overlay that covers and tints your content. Clicking it will hide the sidebar and trigger the sidebarVisible prop with false
sidebarVisiblenonefunctionThis function will trigger false when the sidebar is closed using the overlay. You must handle conditionally not rendering the sidebar when this is triggered
triggerClosenone!booleanIf this prop changes, it will trigger the sidebar to hide, then fire off sidebarVisible once completed. If you are handling closing the sidebar with a button or programatically, you'll want to pass !boolean to it when you're ready to shut it
childrentruenonecontentThis is the content that will appear inside the sidebar

Example:

<Sidebar theme={'dark'} sidebarPosition={'left'} overlay={true} sidebarVisible={() => this.unrenderSidebar()} triggerClose={this.state.boolean}>Child content</Sidebar>
0.3.97

4 years ago

0.3.96

5 years ago

0.3.95

5 years ago

0.3.94

5 years ago

0.3.93

5 years ago

0.3.92

5 years ago

0.3.91

5 years ago

0.3.90

5 years ago

0.3.80

5 years ago

0.3.70

5 years ago

0.3.60

5 years ago

0.3.57

5 years ago

0.3.56

5 years ago

0.3.55

5 years ago

0.3.54

5 years ago

0.3.53

5 years ago

0.3.52

5 years ago

0.3.51

5 years ago

0.3.50

5 years ago

0.2.40

5 years ago

0.2.31

5 years ago

0.2.30

5 years ago

0.2.21

5 years ago

0.2.20

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago