Class: CCS::Components::Base
- Inherits:
-
Object
- Object
- CCS::Components::Base
- Defined in:
- lib/ccs/components/base.rb
Overview
Component base class that all components will inherit from.
It’s main purpose is to handle the initialisation of the options which is very similar between components
Direct Known Subclasses
CCS::ContactUs, CCS::DashboardSection, CCS::DashboardSection::Panel, CCS::Footer, CCS::Footer::Link, CCS::Header, CCS::Header::Link, CCS::Logo, CCS::PasswordStrength, CCS::PasswordStrength::Test, GovUK::Accordion, GovUK::BackLink, GovUK::Breadcrumbs, GovUK::Breadcrumbs::Link, GovUK::Button, GovUK::CookieBanner, GovUK::CookieBanner::Action, GovUK::CookieBanner::Message, GovUK::Details, GovUK::ErrorMessage, GovUK::ErrorSummary, GovUK::ErrorSummary::Item, GovUK::ExitThisPage, GovUK::Field, GovUK::Field::Input::TextInput::Fix, GovUK::Field::Inputs::Item, GovUK::Fieldset, GovUK::Fieldset::Legend, GovUK::Footer, GovUK::Footer::Link, GovUK::FormGroup, GovUK::Header, GovUK::Header::Link, GovUK::Hint, GovUK::InsetText, GovUK::Label, GovUK::NotificationBanner, GovUK::Pagination, GovUK::Pagination::Increment, GovUK::Pagination::Item, GovUK::Panel, GovUK::PhaseBanner, GovUK::ServiceNavigation, GovUK::ServiceNavigation::Link, GovUK::SkipLink, GovUK::StepByStepNavigation, GovUK::StepByStepNavigation::Section, GovUK::SummaryList, GovUK::SummaryList::Action::Link, GovUK::SummaryList::Card, GovUK::SummaryList::Card::Actions, GovUK::SummaryList::Card::Title, GovUK::SummaryList::Row, GovUK::SummaryList::Row::Actions, GovUK::SummaryList::Row::Key, GovUK::SummaryList::Row::Value, GovUK::Table, GovUK::Table::Body::DataCell, GovUK::Table::Body::HeadCell, GovUK::Table::Header::HeadCell, GovUK::Tabs, GovUK::Tabs::Panel, GovUK::Tabs::Tab, GovUK::Tag, GovUK::TaskList, GovUK::TaskList::Item, GovUK::TaskList::Item::Status, GovUK::TaskList::Item::Title, GovUK::WarningText
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the component
{}.freeze
Instance Method Summary collapse
-
#initialize(context:, **options) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(context:, **options) ⇒ Base
Returns a new instance of Base.
32 33 34 35 36 37 38 39 |
# File 'lib/ccs/components/base.rb', line 32 def initialize(context:, **) [:attributes] ||= {} [:attributes][:class] = "#{default_attributes[:class]} #{[:classes]}".strip if default_attributes[:class] || [:classes] ([:attributes][:data] ||= {})[:module] = default_attributes[:data][:module] if default_attributes.dig(:data, :module) @context = context @options = end |