|
| 1 | +import { Component, CUSTOM_ELEMENTS_SCHEMA, Input } from '@angular/core'; |
| 2 | +import { Meta } from '@storybook/angular'; |
| 3 | +import { NgtArgs } from 'angular-three'; |
| 4 | +import { ENVIRONMENT_PRESETS, NgtsStage } from 'angular-three-soba/staging'; |
| 5 | +import { makeDecorators, makeStoryObject, number, select } from '../setup-canvas'; |
| 6 | + |
| 7 | +enum presets { |
| 8 | + rembrandt = 'rembrandt', |
| 9 | + portrait = 'portrait', |
| 10 | + upfront = 'upfront', |
| 11 | + soft = 'soft', |
| 12 | +} |
| 13 | + |
| 14 | +@Component({ |
| 15 | + standalone: true, |
| 16 | + template: ` |
| 17 | + <ngt-color attach="background" *args="['white']" /> |
| 18 | + <ngts-stage [intensity]="intensity" [environment]="envPreset" [preset]="preset"> |
| 19 | + <ngt-mesh> |
| 20 | + <ngt-sphere-geometry *args="[1, 64, 64]" /> |
| 21 | + <ngt-mesh-standard-material roughness="0" color="royalblue" /> |
| 22 | + </ngt-mesh> |
| 23 | + </ngts-stage> |
| 24 | + `, |
| 25 | + imports: [NgtsStage, NgtArgs], |
| 26 | + schemas: [CUSTOM_ELEMENTS_SCHEMA], |
| 27 | +}) |
| 28 | +class DefaultStageStory { |
| 29 | + @Input() intensity = 1; |
| 30 | + @Input() envPreset = Object.keys(ENVIRONMENT_PRESETS)[0]; |
| 31 | + @Input() preset = Object.keys(presets)[0]; |
| 32 | +} |
| 33 | + |
| 34 | +export default { |
| 35 | + title: 'Staging/Stage', |
| 36 | + decorators: makeDecorators(), |
| 37 | +} as Meta; |
| 38 | + |
| 39 | +export const Default = makeStoryObject(DefaultStageStory, { |
| 40 | + canvasOptions: { camera: { position: [0, 0, 3] } }, |
| 41 | + argsOptions: { |
| 42 | + intensity: number(1), |
| 43 | + envPreset: select(Object.keys(ENVIRONMENT_PRESETS)[0], { |
| 44 | + options: Object.keys(ENVIRONMENT_PRESETS), |
| 45 | + }), |
| 46 | + preset: select(Object.keys(presets)[0], { options: Object.keys(presets) }), |
| 47 | + }, |
| 48 | +}); |
0 commit comments