avionschool-components is the component library used to build Avionschool projects.
To add to a repository, clone the latest version into your project's src
folder.
For aliasing, add the following lines to your webpack.config.js
and tsconfig.js
.
// tsconfig.js
{
...{
..."paths": {
...,
"@components": ["./src/components/src/index.ts"]
}
}
}
// webpack.config.js
module.exports = {
...,
resolve: {
...,
alias: {
...,
'@components': path.resolve(__dirname, "./src/components/src/index.ts"),
}
}
}
You can now import from the library using @components
:
import { Button, Datepicker } from '@components';
const App = () => (
<>
<Button type="primary" round={true} text="Hello World"/>
<Input placeholder="input component"/>
</>
);
A simple box component that can also be used for select options.
Standard unique ID of an element
Decides if the box is disabled, and if it displays its requisite styles.
Decides if the box is selected and if it displays its requisite styles.
Function that is called when the component is clicked.
Components that are rendered inside the box.
Decides whether a box can be clicked or not. Similar to isDisabled
, except it does not display the disabled styles.
import React from 'react';
import { Box } from '@components';
const SampleBoxComponent: React.FC = () => {
return (
<>
<Box>
<div className="sample class names">
Sample Box
</div>
</Box>
</>
)
}
A button component!
Standard unique ID of an element
The text displayed inside the button.
Button variant. Accepted values are solid
, ghost
, and outline
.
Decides whether the button is disabled.
Shows the status of the button. Accepted values are error
, success
, and warning
.
Button size. If not specified, will scale to inner content. Accepted values are small
, medium
, large
, and full
.
Icon the button shows. Is of type ReactNode
.
Decides whether the icon appears to the left or to the right of the button's text. Accepted values are left
and right
. left
is selected by default.
Function that fires when the button is clicked.
Additional tailwind classes you might want to add to the button.
Decides whether your want the button to have rounded edges.
Decides if the button should use primary styling.
Turns the button's icon into a loading animation and renders the button unclickable. Boolean.
import React from 'react';
import { Button } from '@components';
import { BiSample } from 'react-icons/bi';
const ModifiedButton: React.FC = () => {
return (
<Button
size="small"
text="Sample Button"
icon={<BiSample/>}
variant="solid"
round={true}
iconLocation="left"
/>
)
}
A checkbox component. Wrap in a label or form tag.
Standard unique ID of an element.
Value of the checkbox option. Is used in forms when selected.
Decides whether the checkbox can be selected.
Boolean property, increases the size of the checkbox when true.
Label of the checkbox
Name of the checkbox
Boolean property, decides if a checkbox is filled.
Event fired when the checkbox checked
property is changed.
Boolean value. When true, it shows the value of the label assigned to the checkbox.
import React from 'react';
import { Checkbox } from '@components';
const SampleCheckbox: React.FC = () => {
return (
<Checkbox
value="samplecheckbox"
label="samplecheckbox"
name="checkbox"
checked={true}
onChange={() => console.log('change')}
/>
)
}
Datepicker component
Standard unique ID of an element.
Default date of the datepicker.
Placeholder text displayed when datepicker's input component is empty.
Name passed to datepicker component, usually used in forms.
Function called when the datepicker's value is changed.
Value assigned to the datepicker.
Decides if the datepicker's input component will display the error values.
import React, { useState } from 'react';
import { Datepicker } from '@components';
const SampleDatepicker: React.FC = () => {
const [date, setDate] = useState<Date>(new Date);
return (
<Datepicker
initialDate={date}
placeholderText="MM/DD/YYYY"
id="datepickersample"
name="datepickerdisplay"
onChange={setDate}
value={date}
/>
)
}
Display boxes used in layouts and choices
string
, can be enrollment
, experience
, or payment
string
, actual values can be referenced in DisplayBox.types.ts
Dropdown/Select component
Standard unique ID of an element.
Form Label for the component
Boolean
. Decides whether component is disabled
Boolean
. Displays component warning styles.
Boolean
. Displays component success styles.
Placeholder text
onChange function for component
Options to be displayed by the component
Any additional classNames you might want to add
Current selected value
Function that runs when blurred
Form Control Component
Label for form control component
Helper text displayed above its controlled component
Message text to be displayed in case of success/error/warning
Boolean
. Decides whether component and its children are disabled.
Boolean
. Decides whether form item is required
Boolean
. Decides whether it should display warning status
Boolean
. Decides whether it should display success status
ReactNode[]
. Decides which children to display inside component
Input Component
Standard unique ID of an element.
Name for component
Label for component
Boolean
. Decides whether component and its children are disabled.
Boolean
. Decides whether form item is required
Boolean
. Decides whether it should display warning status
Boolean
. Decides whether it should display success status
String
. Placeholder for component in case it is empty.
Function called when value of form changes
Value passed inside component in case you need to use it as a externally controlled component
Function called when paste event is triggered
Initial value of component
Any classNames or styles needed for the component
Maximum length accepted by component
In case of input masking, defines the placeholder element while fulfilled length is not met.
Pattern for masking of input element. See https://www.npmjs.com/package/react-input-mask for guidelines.
Boolean
. Defines whether mask should be shown at all times or not
Function called on keypress down. Can be used for mobile devices
Radio Component
NOTE: This is purely a radio component, wrap it with corresponding label and name to create a functional radio group.
Standard unique ID of an element.
Name for component
Label for component
Value of radio item
Boolean
. Decides whether radio item is disabled.
Boolean
. Decides whether radio item is checked.
Function called when value of radio button is changed
Boolean
. Decides whether label passed in is shown. Can be disabled for custom CSS/Elements on label
Sidebar Item Component
NOTE: Pass in an array of the ff properties into the Sidebar
component'sitems
prop to use:
Link to where the item redirects to
Name to be displayed by sidebar item
Boolean
. Decides whether item is the currently selected one.
Boolean
. Decides whether sidebar item is disabled.
Corresponding icon that is displayed beside the name. Use Boxicons.
Function called when item is clicked
Sidebar Component
Logo displayed on desktop view
Alternate display in case logo is not viewable
Logo on mobile view
####mobileLogoAlt
Alternate display in case mobileLogo
is not viewable.
Array of items as specified in Sidebar Items
.
Any tailwind or css classes needed for further customization of the sidebar.
TextArea Component ####Properties
Standard unique ID of an element.
####name
Name for component
Label for component
Boolean
. Decides whether component and its children are disabled.
Boolean
. Decides whether form item is required
Boolean
. Decides whether it should display warning status
Boolean
. Decides whether it should display success status
String
. Placeholder for component in case it is empty.
Function called when value of form changes
Value passed inside component in case you need to use it as a externally controlled component
Initial value of component
Any classNames or styles needed for the component
Maximum length accepted by component
Number
. Number of columns shown in textarea component.
Number
. Number of rows shown in textarea component.
Reusable form for Student and Admin review views
Boolean
. Shows the application form view for Admin
, hiding the change
pointers.
Boolean
. Shows the screening form view for Admin
, hiding the change
pointers.
Boolean
. Shows the application form view for Student
, showing the change
pointers. Requires the navigator
prop
Boolean
. Shows the application form view for Student
, showing the change
pointers. Requires the navigator
prop.
Navigator prop for redirecting, pass in the return value of useNavigate
hook.