Skip to content

✨ feat(font): add includeFont to api #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2024
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Try it in the [Svelte REPL](https://svelte.dev/repl/cae0ce6e92634878b6e1a587146d
| enablePastDates | If disabled, the picker will prevent the user from selecting anything prior to today. | `boolean` (default: `true`)
| theme | The theme name that should be assigned to the theme data-attribute. | `string` (default: `''`)
| presetRanges | The array of present configs to replace the default set with. | `array` (default: [...])
| includeFont | If false, the default Rubik font will not be loaded | `boolean` (default: `true`)

### Events
| Prop | Description | Default |
Expand Down
7 changes: 7 additions & 0 deletions docs/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@
</ul>&rbrace;]
</td>
</tr>
<tr>
<td>includeFont</td>
<td><code>boolean</code></td>
<td>If false, the default font "Rubik" will not be loaded.</td>
<td><code>true</code></td>
</tr>
</table>
</section>

Expand Down Expand Up @@ -304,6 +310,7 @@
</section>

<br>

<section>
<h2>Examples</h2>
<p>Below are different examples of how you can configure the datepicker.</p>
Expand Down
5 changes: 5 additions & 0 deletions src/datepicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ export interface DatePickerProps {
* An array of month labels.
*/
monthLabels?: string[];

/**
* Determines if the default font "Rubik" should be loaded.
*/
includeFont?: boolean;
}

export interface DatePickerEvents {
Expand Down
16 changes: 12 additions & 4 deletions src/datepicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@
'December'
];

/**
* Determines if the default font "Rubik" should be loaded.
* @type {boolean}
*/
export let includeFont = true;

/**
* The number of milliseconds in a day.
* @type {number}
Expand Down Expand Up @@ -1064,10 +1070,12 @@
</div>

<svelte:head>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;800;900&display=swap"
/>
{#if includeFont}
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;800;900&display=swap"
/>
{/if}
</svelte:head>

<style>
Expand Down