discourse/app/assets/javascripts/admin/addon/components/dashboard-period-selector.gjs
Kris f6c5eca485
DEV: add btn-default classes to buttons using default styling (#31039)
All of these buttons use our default grey background styling, but aren't
carrying the `btn-default` class, which makes them easier to target in
themes. This PR adds the class.
2025-01-28 15:40:34 -05:00

41 lines
1.1 KiB
Plaintext

import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
import PeriodChooser from "select-kit/components/period-chooser";
import CustomDateRangeModal from "../components/modal/custom-date-range";
export default class DashboardPeriodSelector extends Component {
@service modal;
availablePeriods = ["yearly", "quarterly", "monthly", "weekly"];
@action
openCustomDateRangeModal() {
this.modal.show(CustomDateRangeModal, {
model: {
startDate: this.args.startDate,
endDate: this.args.endDate,
setCustomDateRange: this.args.setCustomDateRange,
},
});
}
<template>
<div>
<PeriodChooser
@period={{@period}}
@action={{@setPeriod}}
@content={{this.availablePeriods}}
@fullDay={{false}}
/>
<DButton
@icon="gear"
@action={{this.openCustomDateRangeModal}}
@title="admin.dashboard.custom_date_range"
class="btn-default custom-date-range-button"
/>
</div>
</template>
}