Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
940 changes: 518 additions & 422 deletions packages/base/spec.gts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { setupDateLibrary } from './setup.gts';

interface Signature {
Args: {
disabled?: boolean;
end?: Date | null;
onSelect: TPowerCalendarRangeOnSelect;
selected?: SelectedPowerCalendarRange;
Expand Down Expand Up @@ -105,7 +106,7 @@ export default class DateRangePicker extends Component<Signature> {
...attributes
as |calendar|
>
<div class='months-container'>
<div class='months-container {{if @disabled "disabled"}}'>
<div class='month-calendar'>
<calendar.Nav>
<div class='nav-container'>
Expand Down Expand Up @@ -172,6 +173,10 @@ export default class DateRangePicker extends Component<Signature> {
flex-direction: row;
gap: var(--boxel-sp-lg);
}
.months-container.disabled {
pointer-events: none;
opacity: 0.6;
}
.nav-container {
display: flex;
align-items: center;
Expand Down
76 changes: 76 additions & 0 deletions packages/catalog-realm/components/code-snippet.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import GlimmerComponent from '@glimmer/component';
import { CopyButton } from '@cardstack/boxel-ui/components';

export interface CodeSnippetSignature {
Args: {
code: string;
};
Element: HTMLElement;
Blocks: {};
}

export default class CodeSnippet extends GlimmerComponent<CodeSnippetSignature> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the CSSField in card-api and CSSValueField in base realm. I think the component you want here is similar to those.

<template>
<div class='code-snippet-container'>
<header class='code-snippet-header'>
<span class='code-snippet-title'>CODE</span>
<CopyButton
class='code-snippet-copy-button'
@textToCopy={{@code}}
/>
</header>
<pre class='code-snippet' data-test-code-snippet>{{@code}}</pre>
</div>
<style scoped>
.code-snippet-container {
--field-header-bg: var(--boxel-200);
--field-bg: var(--card, var(--boxel-100));
--field-fg: var(--card-foreground, var(--boxel-dark));
--field-border: var(
--border,
color-mix(in oklab, var(--field-fg) 20%, var(--field-bg))
);
display: flex;
flex-direction: column;
}
.code-snippet-copy-button {
margin-left: auto;
}
.code-snippet-header {
border: 1px solid var(--field-border);
border-bottom: none;
border-top-left-radius: var(--radius, var(--boxel-border-radius));
border-top-right-radius: var(--radius, var(--boxel-border-radius));
background-color: var( --field-header-bg);
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--boxel-sp-4xs) var(--boxel-sp-xs);
}
.code-snippet-title {
font-size: var(--boxel-font-size-xs);
letter-spacing: 0.08em;
font-weight: 600;
}
.code-snippet {
margin-block: 0;
padding: var(--boxel-sp);
background-color: var(--field-bg);
border: 1px solid var(--field-border);
border-top: none;
border-bottom-left-radius: var(--radius, var(--boxel-border-radius));
border-bottom-right-radius: var(--radius, var(--boxel-border-radius));
border-top-left-radius: 0;
border-top-right-radius: 0;
color: var(--field-fg);
font-family: var(
--font-mono,
var(--boxel-monospace-font-family, monospace)
);
font-size: var(--boxel-font-size-xs);
white-space: pre-wrap;
word-break: break-word;
}
</style>
</template>
}
Loading